name: Publish cargo crate

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

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6
      - run: rustup toolchain install
      - name: Cache
        uses: Swatinem/rust-cache@v2
      - name: Login
        run: cargo login ${CRATES_IO_TOKEN}
        env:
          CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
      - name: Publish
        run: cargo publish
