name: Publish to crates.io
on:
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions: {}
jobs:
publish-to-crates-io:
name: Publish Rust 🦀 package 📦 to crates.io
runs-on: ubuntu-24.04
environment: cratesio
if: github.event.release.prerelease == false && startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
fetch-depth: 0
persist-credentials: false
- name: Authenticate with registry
uses: rust-lang/crates-io-auth-action@bbd81622f20ce9e2dd9622e3218b975523e45bbe id: auth
- name: Publish package 📦 to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}