Skip to content

Commit 2c26c1b

Browse files
yashdsarafclaude
andcommitted
CD: switch gem-push to RubyGems Trusted Publishing (OIDC)
`gem push` fails since MFA was enabled on the RubyGems account — the API-key flow can't supply an OTP from a non-interactive runner. Trusted publishing is the supported replacement and is already configured on rubygems.org for this gem (pointed at this workflow file, no GitHub Environment binding). Changes: - Add `id-token: write` to job permissions (required for the GitHub OIDC token exchange). - Remove unused `packages: write` permission (was for GitHub Packages, never wired up). - Replace the manual credentials-file dance + `GEM_HOST_API_KEY` env var with `rubygems/configure-rubygems-credentials@v2.0.0` (same action `rubygems/release-gem@v1` calls internally — verified by reading its action.yml). Existing `gem build` + `gem push` then read credentials the action sets up. No new secrets. `RUBYGEMS_AUTH_TOKEN` becomes obsolete and should be deleted from repo Settings → Secrets after the first green dispatch. Tracks LOC-6563. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 52e61e2 commit 2c26c1b

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

.github/workflows/gem-push.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
permissions:
1010
contents: read
11-
packages: write
11+
id-token: write
1212

1313
steps:
1414
- uses: actions/checkout@v3
@@ -17,13 +17,9 @@ jobs:
1717
with:
1818
ruby-version: 2.6.10
1919

20-
- name: Publish to RubyGems
20+
- uses: rubygems/configure-rubygems-credentials@v2.0.0
21+
- name: Build and push gem
2122
run: |
22-
mkdir -p $HOME/.gem
23-
touch $HOME/.gem/credentials
24-
chmod 0600 $HOME/.gem/credentials
25-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
2623
gem build *.gemspec
2724
gem push *.gem
28-
env:
29-
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
25+
shell: bash

0 commit comments

Comments
 (0)