NATS JetStream GitHub Action Pack
This is a collection of GitHub Actions to interact with NATS JetStream.
Action | Description |
---|---|
nats-io/jetstream-gh-action/validate/stream@master | Validates Stream Configuration |
nats-io/jetstream-gh-action/validate/consumer@master | Validates Consumer Configuration |
nats-io/jetstream-gh-action/create/stream@master | Creates Streams |
nats-io/jetstream-gh-action/create/consumer@master | Creates Consumers |
nats-io/jetstream-gh-action/update/stream@master | Updates Streams |
nats-io/jetstream-gh-action/delete/stream@master | Deletes Streams |
nats-io/jetstream-gh-action/delete/consumer@master | Deletes Consumers |
nats-io/jetstream-gh-action/eval/stream@master | Evaluate Stream state |
nats-io/jetstream-gh-action/eval/consumer@master | Evaluate Consumer state |
nats-io/jetstream-gh-action/purge/stream@master | Purge all data from a Stream |
nats-io/jetstream-gh-action@master | Publish to a JetStream Stream |
See individual action directory for detailed usage instructions.
JetStream Service In Workflow
JetStream can be run within the workflow job as a local service, here's an example starting the Service and creating a Stream in it.
on: push
name: orders
jobs:
orders:
runs-on: ubuntu-latest
services:
# starts a JetStream service locally known as "jetstream" on the network
jetstream:
image: synadia/jsm:latest
options: >-
-e JSM_MODE=server
# creates a stream on the "jetstream:4222" server started above
- name: orders_stream
uses: nats-io/jetstream-gh-action/create/stream@master
with:
config: ORDERS.json
server: jetstream:4222
This server is available to all steps in the job that hosts it.
Publishing Messages
Messages can be published to a Stream, or any NATS subject, using the base action.
Usage
on: push
name: consumer
jobs:
consumer_validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: hello
uses: nats-io/jetstream-gh-action@master
with:
subject: ORDERS.deploy
message: Published new deployment via "${{ github.event_name }}" in "${{ github.repository }}"
should_ack: 1
server: nats.example.net:4222
Inputs
Input | Description |
---|---|
subject |
The subject to publish to (required) |
message |
The message payload (required) |
should_ack |
If a positive response from JetStream is required for success |
server |
Comma separated list of NATS Server URLs (required) |
username |
Username or Token to connect with |
password |
Password to connect with |
credentials |
Path to a file holding NATS credentials |
Outputs
Output | Description |
---|---|
response |
Response received or error body |