Skip to content

Commit 5aefe14

Browse files
authored
Merge pull request #276 from cjmartian/add-release-action
Add release action for GPR
2 parents 0ef8c96 + 20148ac commit 5aefe14

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/release.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- '*.*.*'
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
name: Build and Release
11+
runs-on: ubuntu-latest
12+
permissions:
13+
packages: write
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Ruby
18+
uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: '2.6'
21+
- run: bundle install
22+
23+
- name: Publish to GPR
24+
env:
25+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
26+
run: |
27+
mkdir -p $HOME/.gem
28+
touch $HOME/.gem/credentials
29+
chmod 0600 $HOME/.gem/credentials
30+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
31+
gem build *.gemspec
32+
if [ ${{ github.ref_type }} == "tag" ]; then
33+
gem push --verbose \
34+
--key github \
35+
--host https://rubygems.pkg.github.com/${{ github.repository_owner }} \
36+
*.gem
37+
fi
38+
- name: Upload gem as action artifact
39+
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
40+
if: ${{ always() }}
41+
with:
42+
path: *.gem

0 commit comments

Comments
 (0)