Skip to content

ci(release): publish to crates.io on tag via trusted publishing #204

Open

Description

@hermanngeorge15

Part of the 2026-10-24 launch plan (step 1b). Umbrella: #41. Companion: the Cargo.toml issue filed alongside this one.

What

Add a publish-crate job to .github/workflows/release.yml so a v* tag also publishes to crates.io. Today the file says (line 69-70) "injection-scanner ships binaries only -- there is NO crates.io publish job".

Constraints that already bind this file

  • Public repo → GitHub-hosted runner only (CLAUDE.md §CI / Self-Hosted Runners, docs/RELEASE-CHECKLIST.md §7). Do not touch runs-on.
  • The pipeline uses no org secrets, only GITHUB_TOKEN. A long-lived CARGO_REGISTRY_TOKEN would break that rule, so use crates.io Trusted Publishing (OIDC) via rust-lang/crates-io-auth-action; the workflow already has id-token: write for the SLSA attestation.
  • Trusted publishing can only be configured on crates.io after the crate exists. So v0.3.0 is published once by hand from the tagged commit, the trusted publisher is configured, and the CI job proves itself from v0.3.1 on.

How

  publish-crate:
    name: Publish to crates.io
    needs: [release]            # only after the binaries are up and verified
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: read
    steps:
      - uses: actions/checkout@<pinned sha>
      - uses: dtolnay/rust-toolchain@<pinned sha>
      - id: auth
        uses: rust-lang/crates-io-auth-action@<pinned sha>
      - run: cargo publish --locked
        env:
          CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

Pin every action by SHA like the rest of the file. Keep continue-on-error: false: a failed publish should be visible, but it runs after release, so it can never block the binaries.

Done when

  • release.yml comment at line 69-70 updated; job present; actionlint clean.
  • v0.3.0 is on crates.io (manual publish), trusted publisher configured for UnityInFlow/injection-scanner + release.yml.
  • cargo install injection-scanner works on a clean machine and prints injection-scanner 0.3.0.

Effort: ~1.5 h (plus the first manual publish).

Activity

  1. hermanngeorge15 commented on Oct 24, 2026

    @hermanngeorge15
    ContributorAuthor

    Tracking issue: #211. Plan document: docs/reviews/2026-10-24-launch-plan.md.

  2. hermanngeorge15 commented on Oct 25, 2026

    @hermanngeorge15
    ContributorAuthor

    Implemented in draft PR #212 (launch/v0.3.0-packaging). Verified locally; see the PR body for what is blocked on the org Actions allowlist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions