millwright 0.2.1

A unified ML framework for Rust — proven Rust crates, assembled into one machine.
Documentation
name: release-crate

# Publish the Rust crate to crates.io when a version tag is pushed
# (`git tag v0.1.1 && git push --tags`), using crates.io Trusted Publishing
# (OIDC) — no stored token. A manual run (workflow_dispatch) does a `--dry-run`.
on:
  push:
    tags: ["v*"]
  workflow_dispatch:

permissions:
  contents: read

jobs:
  publish:
    name: publish to crates.io
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write # required for crates.io Trusted Publishing (OIDC)
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2

      - name: check tag matches Cargo.toml version
        if: startsWith(github.ref, 'refs/tags/')
        run: |
          tag="${GITHUB_REF_NAME#v}"
          version="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')"
          echo "tag=$tag  Cargo.toml=$version"
          if [ "$tag" != "$version" ]; then
            echo "::error::tag v$tag does not match Cargo.toml version $version"
            exit 1
          fi

      - name: authenticate to crates.io (OIDC)
        if: startsWith(github.ref, 'refs/tags/')
        id: auth
        uses: rust-lang/crates-io-auth-action@v1

      - name: publish
        if: startsWith(github.ref, 'refs/tags/')
        env:
          CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
        run: cargo publish --locked

      - name: dry-run (manual runs only)
        if: ${{ !startsWith(github.ref, 'refs/tags/') }}
        run: cargo publish --locked --dry-run