Skip to content

Commit 521cd34

Browse files
committed
🔧🔒 Configure RubyGem Trusted Publishing
This requires additional configuration on the RubyGems website: * https://guides.rubygems.org/trusted-publishing/adding-a-publisher/ * https://rubygems.org/gems/net-imap/trusted_publishers Note that the RubyGems configuration must match both of the following: * the workflow filename: `release-gem.yml` * the job's environment: `RubyGems`
1 parent 119f43a commit 521cd34

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/release-gem.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish gem to rubygems.org
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
push:
10+
if: github.repository == 'ruby/net-imap'
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
id-token: write # mandatory for trusted publishing
15+
contents: write # required for `rake release` to push the release tag
16+
17+
environment:
18+
name: RubyGems
19+
url: https://rubygems.org/gems/net-imap
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Ruby
25+
uses: ruby/setup-ruby@v1
26+
with:
27+
bundler-cache: true
28+
ruby-version: 3.2
29+
30+
- name: Publish to RubyGems
31+
uses: rubygems/release-gem@v1
32+
33+
- name: Create GitHub release
34+
run: |
35+
tag_name="$(git describe --tags --abbrev=0)"
36+
gh release create "${tag_name}" --verify-tag --draft --generate-notes
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)