Skip to content

Commit bde5db1

Browse files
improve release flow
1 parent 30c210d commit bde5db1

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ name: Release
33
# Publishes the gem to RubyGems when a GitHub Release is published.
44
# Uses RubyGems Trusted Publishing (OIDC) — no API key is stored in the repo.
55
#
6-
# One-time setup on rubygems.org (Gem → Settings → Trusted Publishers, or a
7-
# "pending" trusted publisher for the very first push):
6+
# This builds and pushes the gem directly (no `rake release` / git tagging),
7+
# because the GitHub Release already created the tag.
8+
#
9+
# One-time setup on rubygems.org (Gem → Ownership/Trusted Publishers, or a
10+
# "pending" trusted publisher before the first push):
811
# - Repository: testingbot/testingbot_ruby
912
# - Workflow filename: release.yml
10-
# - (Environment: leave blank, or set one and add it under `environment:` below)
13+
# - Environment: leave blank
1114
on:
1215
release:
1316
types: [published]
@@ -20,10 +23,12 @@ jobs:
2023
name: Build and publish gem
2124
runs-on: ubuntu-latest
2225
permissions:
23-
contents: write # create the build-provenance attestation
26+
contents: read
2427
id-token: write # request the OIDC token for Trusted Publishing
2528
steps:
2629
- uses: actions/checkout@v4
30+
with:
31+
persist-credentials: false
2732

2833
- name: Set up Ruby
2934
uses: ruby/setup-ruby@v1
@@ -34,5 +39,11 @@ jobs:
3439
- name: Unit tests (gate)
3540
run: bundle exec rake unit
3641

37-
- name: Publish to RubyGems
38-
uses: rubygems/release-gem@v1
42+
- name: Configure RubyGems trusted publishing (OIDC)
43+
uses: rubygems/configure-rubygems-credentials@v2.0.0
44+
45+
- name: Build gem
46+
run: gem build testingbot.gemspec
47+
48+
- name: Push to RubyGems
49+
run: gem push testingbot-*.gem

0 commit comments

Comments
 (0)