name: Continuous delivery - crates.io

on:
  release:
    types: [published]
  workflow_dispatch:

jobs:
  publish:
    runs-on: ubuntu-latest
    environment: crates.io
    permissions:
      id-token: write
    steps:
    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8  # v5.0.0
    - uses: rust-lang/crates-io-auth-action@e919bc7605cde86df457cf5b93c5e103838bd879  # v1.0.1
      id: auth
    - run: cargo publish
      env:
        CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
