name: Publish to crates.io

# User-defined cargo-dist publish job, referenced from dist-workspace.toml as
# `./publish-crates-io`. This file is owned by us and survives
# `dist generate` regenerations of release.yml.

on:
  workflow_call:
    inputs:
      plan:
        required: true
        type: string

jobs:
  publish-crates-io:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v6
        with:
          persist-credentials: false
          submodules: recursive
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
      - name: Publish to crates.io
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish
