Use RubyGems trusted publishing in the publish workflow#94
Merged
Conversation
Replace the manually-entered API key and OTP inputs with OIDC-based trusted publishing via rubygems/configure-rubygems-credentials, so publishing no longer requires handling long-lived credentials.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
eebs
approved these changes
Jul 2, 2026
|
The changes in this PR were just released in 5.2.0 🎉. |
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.
I just configured GitHub Actions as a trusted publisher for the
ynabgem on RubyGems.org, which means publishing no longer needs a manually pasted API key and OTP code every time we run the workflow. This updatespublish.ymlaccordingly.The workflow now requests a GitHub OIDC token (via the new
id-token: writepermission) and exchanges it for a short-lived RubyGems key using the officialrubygems/configure-rubygems-credentialsaction, pinned to a commit SHA like our other actions. That replaces the step that wrote the pasted key into~/.gem/credentials, and since trusted publishing tokens bypass the OTP requirement, both therubygems_api_keyandrubygems_otpinputs are gone, along with theaction-hide-sensitive-inputsstep that existed only to mask them in the logs.One thing to notice: adding an explicit
permissionsblock replaces the default token permissions, so the block also includescontents: write(for the release creation step) andissues: write/pull-requests: write(for the step that comments on released PRs). Everything downstream (rake publish, the version bump, the GitHub release) is unchanged.Testing
This can only really be verified by running the publish workflow itself, so the next release will be the proof. The trusted publisher on RubyGems.org is registered against this repo with workflow filename
publish.ymland no environment restriction, matching this configuration.