Skip to content

Commit dec760c

Browse files
committed
Add gem publishing workflow
1 parent 1976c4e commit dec760c

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

.github/workflows/publish-gem.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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/prism'
14+
runs-on: ubuntu-latest
15+
16+
environment:
17+
name: rubygems.org
18+
url: https://rubygems.org/gems/prism
19+
20+
permissions:
21+
contents: write
22+
id-token: write
23+
24+
strategy:
25+
matrix:
26+
ruby: ["ruby"]
27+
28+
steps:
29+
- name: Harden Runner
30+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
31+
with:
32+
egress-policy: audit
33+
34+
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2
35+
36+
- name: Set up Ruby
37+
uses: ruby/setup-ruby@eaecf785f6a34567a6d97f686bbb7bccc1ac1e5c # v1.237.0
38+
with:
39+
ruby-version: ${{ matrix.ruby }}
40+
41+
- name: Install dependencies
42+
run: bundle install --jobs 4 --retry 3
43+
44+
- name: Publish to RubyGems
45+
uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
46+
47+
- name: Create GitHub release
48+
run: |
49+
tag_name="$(git describe --tags --abbrev=0)"
50+
gh release create "${tag_name}" --verify-tag --generate-notes
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)