Skip to content

Commit 7bfdbcc

Browse files
committed
Add RubyGems trusted publishing workflow
1 parent 71d93c0 commit 7bfdbcc

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish:
13+
name: Publish to RubyGems
14+
runs-on: ubuntu-latest
15+
environment: release
16+
permissions:
17+
contents: write
18+
id-token: write
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v7
22+
with:
23+
persist-credentials: false
24+
- name: Set up Ruby
25+
uses: ruby/setup-ruby@v1
26+
with:
27+
ruby-version: '3.3'
28+
bundler-cache: true
29+
- name: Release gem
30+
uses: rubygems/release-gem@v1

‎README.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,21 @@ $ sudo env PATH="$PATH" GEM_HOME="$GEM_HOME" GEM_PATH="$GEM_PATH" \
6161

6262
Regenerate the unit with `--force` after a Ruby upgrade. See
6363
[docs/systemd.md](docs/systemd.md) for the full guide.
64+
65+
## Release
66+
67+
Releases use RubyGems [trusted publishing](https://guides.rubygems.org/trusted-publishing) —
68+
no API tokens. The trusted publisher must be registered for this repo and the
69+
`release.yml` workflow on RubyGems.org (a pending publisher becomes a normal
70+
one after its first push). To release:
71+
72+
1. Bump the version in `passenger_datadog.gemspec` and add a `CHANGELOG.md` entry.
73+
2. Commit, tag, and push:
74+
75+
```
76+
$ git tag v2.0.0
77+
$ git push origin v2.0.0
78+
```
79+
80+
`.github/workflows/release.yml` builds the gem and pushes it to RubyGems.org,
81+
authenticating with an OIDC token scoped to this gem.

‎Rakefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ require 'rake'
44
require 'rspec/core'
55
require 'rspec/core/rake_task'
66
require 'rubocop/rake_task'
7+
require 'bundler/gem_tasks'
78

89
RSpec::Core::RakeTask.new(:spec)
910

0 commit comments

Comments
 (0)