name: Release
on:
workflow_dispatch:
inputs:
rust:
description: Publish the root Rust crate to crates.io
type: boolean
default: false
concurrency:
group: release-main
cancel-in-progress: false
permissions:
contents: read
jobs:
publish-rust:
name: Publish Rust Crate
if: ${{ inputs.rust }}
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: .
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets -- -D warnings
- name: Run tests
run: cargo test
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}