ci(release): switch crates.io publish to Trusted Publishing (OIDC)#12
Open
dkijania wants to merge 1 commit into
Open
ci(release): switch crates.io publish to Trusted Publishing (OIDC)#12dkijania wants to merge 1 commit into
dkijania wants to merge 1 commit into
Conversation
Removes the long-lived CARGO_REGISTRY_TOKEN dependency on the `publish`
job. Authentication flows through GitHub Actions OIDC:
rust-lang/crates-io-auth-action exchanges the short-lived id-token for
a single-use crates.io API token, scoped to this workflow + ref.
Keeps the existing job structure intact:
test → publish-dry-run → publish (gated by `crates-io` environment).
Adds:
- `id-token: write` permission on the `publish` job (other jobs don't
need OIDC, so scope it tight).
- rust-lang/crates-io-auth-action@v1 step before cargo publish.
- Threads the action's output token into CARGO_REGISTRY_TOKEN.
Prereqs before this workflow can succeed on the next release:
1. Configure trusted publisher on https://crates.io/crates/mina-sdk
→ Settings → Trusted Publishers → Add GitHub Actions:
org=MinaProtocol, repo=mina-sdk-rust, workflow=release.yml,
environment=crates-io.
2. (Recommended) Add a GitHub team as crate co-owner so ownership
tracks org membership instead of a single user:
cargo owner --add github:o1-labs:eng mina-sdk
The existing CARGO_REGISTRY_TOKEN repo secret is no longer read; it
can be revoked once OIDC publishing has succeeded once, or kept as a
dormant emergency fallback (unused).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the long-lived
CARGO_REGISTRY_TOKENdependency on thepublishjob. Authentication flows through GitHub Actions OIDC:rust-lang/crates-io-auth-actionexchanges the short-lived OIDC token for a single-use crates.io API token, scoped to this workflow + ref.Existing structure preserved:
test→publish-dry-run→publish(gated by thecrates-ioGitHub Environment). Only the publish step changes.What this PR changes
id-token: writepermission scoped to thepublishjob (the other jobs don't need OIDC).cargo publishusingrust-lang/crates-io-auth-action@v1.CARGO_REGISTRY_TOKENfor the publish step.Prereqs before merging
Both are one-time actions. They don't block the merge itself — but the next release after this lands will fail at the auth step unless these are in place.
```
cargo owner --add github:o1-labs:eng mina-sdk
```
Currently the crate is sole-owned by `dkijania` — adding the team gives the rest of o1-labs/eng publish rights.
Why
After OIDC publishing has succeeded once, the existing `CARGO_REGISTRY_TOKEN` repo secret can be revoked (or kept as a dormant fallback — this workflow no longer reads it).
🤖 Generated with Claude Code