Skip to content

Commit d81023c

Browse files
committed
Enabled trusted publisher for rubygems.org
1 parent defbdf9 commit d81023c

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/push_gem.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Publish gem to rubygems.org
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
push:
13+
if: github.repository == 'ruby/cgi'
14+
runs-on: ubuntu-latest
15+
16+
environment:
17+
name: rubygems.org
18+
url: https://rubygems.org/gems/cgi
19+
20+
permissions:
21+
contents: write
22+
id-token: write
23+
24+
strategy:
25+
matrix:
26+
ruby: ["3.3", "jruby"]
27+
28+
steps:
29+
- name: Harden Runner
30+
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
31+
with:
32+
egress-policy: audit
33+
34+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
35+
36+
- name: Set up Ruby
37+
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
38+
with:
39+
ruby-version: ${{ matrix.ruby }}
40+
41+
# https://github.com/rubygems/rubygems/issues/5882
42+
- name: Install dependencies and build for JRuby
43+
run: |
44+
sudo apt install default-jdk maven
45+
gem update --system
46+
gem install ruby-maven rake-compiler --no-document
47+
rake compile
48+
if: matrix.ruby == 'jruby'
49+
50+
- name: Install dependencies
51+
run: bundle install --jobs 4 --retry 3
52+
53+
- name: Publish to RubyGems
54+
uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
55+
56+
- name: Create GitHub release
57+
run: |
58+
tag_name="$(git describe --tags --abbrev=0)"
59+
gh release create "${tag_name}" --verify-tag --generate-notes
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}
62+
if: matrix.ruby != 'jruby'

0 commit comments

Comments
 (0)