Skip to content

Commit caf1301

Browse files
authored
Add publish workflow (#39)
This new workflow will, on the creation of a new GitHub Release, package and publish a version of the gem to RubyGems.org and GitHub Packages.
1 parent 0d349dd commit caf1301

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
ci:
9+
name: CI
10+
uses: ./.github/workflows/ci.yml
11+
publish-to-rubygems:
12+
name: Publish to RubyGems
13+
permissions:
14+
contents: write
15+
id-token: write
16+
needs: ci
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: ruby/setup-ruby@v1
21+
with:
22+
bundler-cache: true
23+
- uses: rubygems/release-gem@v1
24+
with:
25+
await-release: false
26+
publish-to-github-packages:
27+
name: Publish to GitHub Packages
28+
permissions:
29+
contents: read
30+
packages: write
31+
needs: ci
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: ruby/setup-ruby@v1
36+
with:
37+
bundler-cache: true
38+
- run: |
39+
mkdir -p $HOME/.gem
40+
touch $HOME/.gem/credentials
41+
chmod 0600 $HOME/.gem/credentials
42+
printf -- "---\n:github: Bearer ${{ secrets.GITHUB_TOKEN }}\n" > $HOME/.gem/credentials
43+
- run: bundle exec rake release
44+
env:
45+
BUNDLE_GEM__PUSH_KEY: github
46+
RUBYGEMS_HOST: "https://rubygems.pkg.github.com/${{ github.repository_owner }}"

0 commit comments

Comments
 (0)