From f5c549331b1f7b2091ee7286888b0fe9d8db7d79 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Tue, 18 Aug 2026 16:35:00 +0800 Subject: [PATCH] ci(release): publish via OIDC trusted publishing The FONTIST_CI_RUBYGEMS_API_KEY org secret was removed in the migration to trusted publishing, so the credentials-file heredoc (plus the no-arg gem signin) would write empty credentials and fail. Exchange the job's OIDC token for a short-lived API key with rubygems/configure-rubygems-credentials instead; id-token: write is already granted. The gem's trusted publisher (fontist/ffi-libarchive-binary @ release.yml) is configured on rubygems.org. --- .github/workflows/release.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75b5d8a..5584565 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,19 +120,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Exchange the job's OIDC token (id-token: write) for a short-lived + # RubyGems API key — the FONTIST_CI_RUBYGEMS_API_KEY org secret was + # removed in the migration to trusted publishing. + - name: Configure RubyGems credentials (trusted publishing) + uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0 + - name: Publish to rubygems.org - env: - RUBYGEMS_API_KEY: ${{secrets.FONTIST_CI_RUBYGEMS_API_KEY}} run: | - mkdir -p ~/.gem - touch ~/.gem/credentials - cat > ~/.gem/credentials << EOF - --- - :rubygems_api_key: ${RUBYGEMS_API_KEY} - EOF - chmod 0600 ~/.gem/credentials - gem signin - mkdir tmp for gem in pkg/*.gem; do gem push -V "$gem" || echo "Warning: Failed to push $gem" done