name: Publish (crates.io)
on:
release:
types:
- published
env:
CARGO_TERM_COLOR: always
jobs:
publish:
environment: default
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
- name: Check formatting
run: cargo fmt --all -- --check
- name: Lint with clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --locked
- name: Dry-run publish
run: cargo publish --locked --dry-run
- name: Publish to crates.io
run: cargo publish --locked --token ${{ secrets.CARGO_REGISTRY_TOKEN }}