Switch gem-publish to RubyGems OIDC trusted publishing#224
Merged
Conversation
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.
What
Switches the
gem-publishjob to RubyGems OIDC trusted publishing instead of a long-lived API key.Why
The
gem-publishjob currently fails at the push step:square.gemspecsetsrubygems_mfa_required = "true", which RubyGems enforces server-side. CI authenticates with onlyGEM_HOST_API_KEY, which doesn't satisfy the MFA requirement, so every tagged release fails to publish.Failing run: https://github.com/square/square-ruby-sdk/actions/runs/26183986707/job/77034487771
Change
In
.github/workflows/ci.yml, thegem-publishjob now:permissions: { id-token: write, contents: read }rubygems/configure-rubygems-credentials@v1.0.0to mint a short-lived OIDC tokenGEM_HOST_API_KEY/RUBYGEMS_API_KEYsecret from the push stepThis keeps the MFA requirement intact (no security downgrade) and removes the long-lived API key. It mirrors what the current Fern Ruby generator (
fern-ruby-sdkrc68+) emits natively; this repo's.github/workflowsis.fernignore-protected, so this edit is durable and won't be overwritten on regeneration.Action required before this works (gem owner)
After merging, register this repo as a Trusted Publisher on RubyGems for the
square.rbgem:RubyGems →
square.rb→ Settings → Trusted Publishers → Add a GitHub Actions publisher:square/square-ruby-sdkci.ymlOnce that's set, the next tagged release will publish via OIDC with no API key.