Powered By GitBook
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
5
# First we delete the ORDERS stream and consumer if they already exist
6
clean_orders:
7
runs-on: ubuntu-latest
8
steps:
9
- name: orders_stream
10
uses: nats-io/jetstream-gh-action/delete/[email protected]
11
with:
12
missing_ok: 1
13
stream: ORDERS
14
server: js.example.net
15
16
# Now we create the Stream and Consumers using the same configuration files the
17
# nats CLI utility would use as shown above
18
create_orders:
19
runs-on: ubuntu-latest
20
needs: clean_orders
21
steps:
22
- uses: actions/[email protected]
23
- name: orders_stream
24
uses: nats-io/jetstream-gh-action/create/[email protected]
25
with:
26
config: ORDERS.json
27
server: js.example.net
28
- name: orders_new_consumer
29
uses: nats-io/jetstream-gh-action/create/[email protected]
30
with:
31
config: ORDERS_NEW.json
32
stream: ORDERS
33
server: js.example.net
34
35
# We publish a message to a specific Subject, perhaps some consumer is
36
# waiting there for it to kick off tests
37
publish_message:
38
runs-on: ubuntu-latest
39
needs: create_orders
40
steps:
41
- uses: actions/[email protected]
42
- name: orders_new_consumer
43
uses: nats-io/jetstream-gh-[email protected]
44
with:
45
subject: ORDERS.deployment
46
message: Published new deployment via "${{ github.event_name }}" in "${{ github.repository }}"
47
server: js.example.net
Copied!
Last modified 7mo ago
Export as PDF
Copy link