name: Publish
on:
push:
tags:
- "*"
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write steps:
- uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Format check
run: cargo fmt --all -- --check
- name: Lint (clippy)
run: cargo clippy --locked --all-targets --all-features -- -D warnings
- name: Build
run: cargo build --verbose --locked
- name: Run tests
run: cargo test --all --verbose --locked
- name: Build docs
run: cargo doc --all --no-deps --locked
- uses: actions/checkout@v6
- uses: rust-lang/crates-io-auth-action@v1
id: auth
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}