feat: add crates.io trusted publishing support via OIDC#366
Merged
EricCrosson merged 1 commit intosemantic-release-action:masterfrom Feb 23, 2026
Merged
Conversation
When no cargo-registry-token is provided, use rust-lang/crates-io-auth-action@v1 to obtain a short-lived OIDC token from crates.io. Fully backwards-compatible: existing users who pass a token are unaffected.
Collaborator
|
Thanks @starfy84 ! |
|
🎉 This PR is included in version 5.3.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
cargo-registry-tokenis provided, usesrust-lang/crates-io-auth-action@v1to obtain a short-lived OIDC token from crates.iocargo-registry-tokenare completely unaffected (the OIDC step is skipped viaifcondition)How it works
In both
semantic-release-binary/action.ymlandsemantic-release-library/action.yml, a new conditional step is added before the semantic-release step:cargo-registry-tokenis provided: OIDC step is skipped, token falls through toinputs.cargo-registry-tokencargo-registry-tokenis empty: OIDC step runs, obtains a short-lived token, that token is usedCallers need
id-token: writepermission and must configure their crates on crates.io with a trusted publisher.Verified
This has been tested in production on starfy84/git-seek using a fork of this action, successfully publishing two crates via trusted publishing: