name: Publish to crates.io

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

jobs:
  publish-crates:
    runs-on: ubuntu-latest
    env:
      PLAN: ${{ inputs.plan }}
    steps:
      - uses: actions/checkout@v6
        with:
          persist-credentials: false

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Publish
        run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --allow-dirty
