Skip to content

Commit b0d3524

Browse files
committed
Add workflow to build and release .gem file
Signed-off-by: Sven Strickroth <[email protected]>
1 parent 4f8689a commit b0d3524

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-ruby
2+
3+
name: Release Gem
4+
5+
on:
6+
push:
7+
tags:
8+
- v*
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build:
15+
if: "github.repository_owner == 'csware'"
16+
name: "Release Gem (Ruby ${{ matrix.ruby_version }})"
17+
runs-on: "ubuntu-latest"
18+
strategy:
19+
fail-fast: true
20+
matrix:
21+
ruby_version:
22+
- 2.0
23+
steps:
24+
- name: Checkout Repository
25+
uses: actions/checkout@v4
26+
- name: "Set up Ruby ${{ matrix.ruby_version }}"
27+
uses: ruby/setup-ruby@7bae1d00b5db9166f4f0fc47985a3a5702cb58f0
28+
with:
29+
ruby-version: ${{ matrix.ruby_version }}
30+
bundler-cache: true
31+
- name: Build and publish to RubyGems
32+
run: |
33+
mkdir -p $HOME/.gem
34+
touch $HOME/.gem/credentials
35+
chmod 0600 $HOME/.gem/credentials
36+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
37+
gem build *.gemspec
38+
gem push *.gem
39+
env:
40+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
41+
- name: Store artifact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: gem.zip
45+
path: '*.gem'

0 commit comments

Comments
 (0)