Skip to content

Commit 5fee493

Browse files
committed
ci: add RubyGems publish workflow triggered on v* tags
1 parent 2ccbad9 commit 5fee493

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Version tag to publish (e.g. v1.0.0)'
11+
required: true
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
publish:
18+
name: Publish to RubyGems
19+
runs-on: ubuntu-latest
20+
environment: rubygems
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 1
26+
27+
- name: Set up Ruby
28+
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
29+
with:
30+
ruby-version: .ruby-version
31+
bundler-cache: true
32+
33+
- name: Build gem
34+
run: gem build arcp.gemspec
35+
36+
- name: Publish to RubyGems
37+
env:
38+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
39+
run: |
40+
mkdir -p ~/.gem
41+
printf -- "---\n:rubygems_api_key: %s\n" "$GEM_HOST_API_KEY" > ~/.gem/credentials
42+
chmod 0600 ~/.gem/credentials
43+
gem push arcp-*.gem
44+
rm -f ~/.gem/credentials

0 commit comments

Comments
 (0)