Skip to content

ci: publish to RubyGems via trusted publishing (OIDC) - #158

Merged
mdp merged 1 commit into
mainfrom
mdp/trusted-publishing
Oct 29, 2026
Merged

mdp merged 1 commit into
mainfrom
mdp/trusted-publishing

Conversation

@mdp

@mdp mdp commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Why

The RubyGems account enforces MFA, so the gem push step from #157 cannot complete unattended — the run hangs on the WebAuthn/OTP prompt until it is cancelled (confirmed in run 40903368260).

What

  • Publish via RubyGems Trusted Publishing: GitHub Actions exchanges its OIDC token for a short-lived, gem-scoped credential. No long-lived secret.
  • id-token: write on the publish job; rubygems/configure-rubygems-credentials@v2.1.0 before gem push.
  • Job timeout-minutes: 20 so auth failures fail fast instead of hanging.
  • Manual dispatch only publishes when a tag is provided.
  • Switch to googleapis/release-please-action and drop the invalid package-name/version-file action inputs.
  • Declare release-type and version-file in release-please-config.json so release PRs bump lib/rotp/version.rb (missing since 6.3.0 — that's why the stale 6.3.1 PR never bumped it).

One-time setup (outside this PR)

On rubygems.org, add a trusted publisher for the rotp gem:

  • Repository owner: mdp
  • Repository name: rotp
  • Workflow filename: release.yaml
  • Environment: (leave blank)

Once configured, the existing RUBYGEMS_AUTH_TOKEN secret can be deleted.

The RubyGems account enforces MFA, so `gem push` with the
RUBYGEMS_AUTH_TOKEN secret cannot complete unattended (the run hangs on
the WebAuthn/OTP prompt, then times out). Switch to RubyGems Trusted
Publishing: GitHub Actions exchanges its OIDC token for a short-lived,
gem-scoped credential, so no long-lived secret is needed.

- Use rubygems/configure-rubygems-credentials@v2.1.0 and grant
  `id-token: write` on the publish job
- Add a job timeout so an auth failure fails fast instead of hanging
- Only run the publish job on a manual dispatch when a tag is supplied
- Use googleapis/release-please-action and drop the invalid
  package-name/version-file inputs

Also declare `release-type` and `version-file` in
release-please-config.json so release PRs bump lib/rotp/version.rb
(they have not since 6.3.0).
@mdp
mdp merged commit eaae758 into main Oct 29, 2026
8 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