Skip to content

Match release environment to the rubygems.org trusted publisher - #10

Merged
delano merged 2 commits into
mainfrom
fix/release-environment-name
Jul 30, 2026
Merged

Match release environment to the rubygems.org trusted publisher#10
delano merged 2 commits into
mainfrom
fix/release-environment-name

Conversation

@delano

@delano delano commented Jul 30, 2026

Copy link
Copy Markdown
Member

Why

The v0.6.0 tag push (run 30524090986) failed at the publish step:

Error: No trusted publisher configured for this workflow found on https://rubygems.org for audience rubygems.org

Checkout, Ruby setup, the tag/version check and the tests all passed. The failure was entirely the OIDC claim check, and nothing was published.

RubyGems compares the token's environment claim against the trusted publisher record as a plain string. The record is registered with environment rubygems.org; release.yml declared rubygems. No match, no token.

The rubygems.org in the error text is the audience claim — always that value, whatever the environment is. It reads like confirmation that the environment was correct, which is what made this hard to spot.

What changed

  • release.yml uses rubygems.org, in the name:/url: mapping form so the deployment links to the gem page. This matches what familia, otto and bone already do; onetime-ruby was the only outlier.
  • docs/releasing.md records the exact-match requirement and the audience/environment distinction, and notes the environment is auto-created on first run rather than needing manual setup.

No change to the RubyGems-side record — the repo now matches it.

Follow-ups, not in this PR

  • Re-running the failed run won't help: a tag-push run uses the workflow file at the tag, so v0.6.0 still carries environment: rubygems. Publishing 0.6.0 needs the tag moved to a commit containing this fix, or a fresh version.
  • The empty rubygems environment on GitHub is now orphaned (no protection rules) and can be deleted.

The v0.6.0 tag push failed at the publish step with "No trusted publisher
configured for this workflow found on https://rubygems.org for audience
rubygems.org". Every other step passed; the failure was purely the OIDC
claim check.

RubyGems compares the token's `environment` claim to the trusted publisher
record as a plain string. The record is registered as `rubygems.org`, the
workflow declared `rubygems`, so nothing matched. The `rubygems.org` in the
error text is the audience claim, which is always that value regardless of
environment -- easy to read as confirmation that the environment was right.

Use `rubygems.org`, which is what familia, otto and bone already use, and
adopt their mapping form so the deployment links to the gem page. Document
the exact-match requirement and the audience/environment distinction.
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown

Required label not found on this PR.

The previous rewrite led with "the environment is created automatically",
which turns a setup step into a no-op: auto-created environments have no
protection rules and no branch policy, so a reader who follows that text
ends up with nothing gating the release job.

State the gating as the required action, and say what it guards -- a job
holding `id-token: write` and `contents: write` that runs on any `v*` tag
from any ref.
@delano

delano commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

A background security review flagged a control regression here. Splitting it:

Workflow — not a regression. The old rubygems environment had protection_rules: [] and deployment_branch_policy: null. The new rubygems.org is auto-created equally bare. The rename moves zero controls, because there were none to move.

Docs — was a real weakening, now fixed in 3472c81. My rewrite of step 5 led with "the environment is created automatically the first time the workflow runs", turning a setup step into a no-op. Auto-created environments are unprotected, so anyone following that text would have ended up with nothing gating the release job. Step 5 is imperative again and now says what it guards.

Pre-existing exposure, not introduced here and not fixed here: no environment in this repo gates the release job today. rubygems has no protection rules and no branch policy, so any v* tag from any ref publishes — including a tag on an unmerged branch carrying a modified release.yml. Worth setting a deployment branch policy on rubygems.org before the next release attempt.

@delano
delano merged commit c9ecb22 into main Jul 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant