Skip to content

Publish on Crates.io #10

Publish on Crates.io

Publish on Crates.io #10

name: Publish on Crates.io
on:
release:
types:
- published
env:
CI: true
RUST_VERSION: 1.79.0
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
publish-crates:
name: Publish on Crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set NATS environment variables
shell: bash
run: |
set_env_var() {
echo "$1=${!1:-$2}" >> $GITHUB_ENV
echo "$1=${!1:-$2}" >> .env
}
set_env_var "NATS_URL" "nats://127.0.0.1:4222"
set_env_var "NATS_ADMIN_PASS" "default_pass"
set_env_var "NATS_PUBLIC_PASS" "default_pass"
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
target: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
- name: Publish Crate
uses: katyo/publish-crates@v2
id: publish-crates
with:
publish-delay: 60000
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ignore-unpublished-changes: true