GitHub Actions

We have a pack of GitHub Actions that let you manage an already running JetStream Server, useful for managing releases or standing up test infrastructure.

Full details and examples are in the jetstream-gh-actions repository, here’s an example.

  1. on: push
  2. name: orders
  3. jobs:
  4. # First we delete the ORDERS stream and consumer if they already exist
  5. clean_orders:
  6. runs-on: ubuntu-latest
  7. steps:
  8. - name: orders_stream
  9. uses: nats-io/jetstream-gh-action/delete/stream@master
  10. with:
  11. missing_ok: 1
  12. stream: ORDERS
  13. server: js.example.net
  14. # Now we create the Stream and Consumers using the same configuration files the
  15. # nats CLI utility would use as shown above
  16. create_orders:
  17. runs-on: ubuntu-latest
  18. needs: clean_orders
  19. steps:
  20. - uses: actions/checkout@master
  21. - name: orders_stream
  22. uses: nats-io/jetstream-gh-action/create/stream@master
  23. with:
  24. config: ORDERS.json
  25. server: js.example.net
  26. - name: orders_new_consumer
  27. uses: nats-io/jetstream-gh-action/create/consumer@master
  28. with:
  29. config: ORDERS_NEW.json
  30. stream: ORDERS
  31. server: js.example.net
  32. # We publish a message to a specific Subject, perhaps some consumer is
  33. # waiting there for it to kick off tests
  34. publish_message:
  35. runs-on: ubuntu-latest
  36. needs: create_orders
  37. steps:
  38. - uses: actions/checkout@master
  39. - name: orders_new_consumer
  40. uses: nats-io/jetstream-gh-action@master
  41. with:
  42. subject: ORDERS.deployment
  43. message: Published new deployment via "${{ github.event_name }}" in "${{ github.repository }}"
  44. server: js.example.net