name: Publish
on:
release:
types: [published]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check
run: cargo check --all-targets --all-features --verbose --locked
- name: Build
run: cargo build --verbose --locked
- name: Run tests
run: cargo test --all-targets --all-features --verbose --locked
- name: Publish crate
run: cargo publish --verbose --locked
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}