Skip to content

Commit 92f9dd5

Browse files
Merge pull request #158 from hiroyuki-sato/topic/publish-to-rubygems
Add GitHub Actions for publish to Rubygems
2 parents c05086e + 828e8ab commit 92f9dd5

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish
2+
on:
3+
push:
4+
tags:
5+
- "v0.*"
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: true
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Ruby
14+
uses: ruby/setup-ruby@v1
15+
with:
16+
ruby-version: 3.3.0
17+
# get tag variable using {{ github.ref_name }}
18+
#
19+
# References:
20+
# * https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
21+
# * https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
22+
- name: extract gem version from tag
23+
id: vars
24+
run: echo version=${{ github.ref_name }} | sed -e 's/v0/0/' >> $GITHUB_OUTPUT
25+
#
26+
# From gem push documents.
27+
#
28+
# The push command will use ~/.gem/credentials to authenticate to a server,
29+
# but you can use the RubyGems environment variable GEM_HOST_API_KEY
30+
# to set the api key to authenticate.
31+
#
32+
# https://guides.rubygems.org/command-reference/#gem-push
33+
#
34+
- name: Publish
35+
run: |
36+
rake build
37+
gem push pkg/${EMBULK_PLUGIN_NAME}-${{ steps.vars.outputs.version }}.gem
38+
env:
39+
EMBULK_PLUGIN_NAME: embulk-output-bigquery
40+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"

0 commit comments

Comments
 (0)