Skip to content

Commit ca08bee

Browse files
committed
update github actions workflows and add gem push workflow
1 parent 98de031 commit ca08bee

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
name: Build
2-
on: [ push, pull_request ]
2+
on: [ push, pull_request, workflow_dispatch ]
33
jobs:
44
test:
55
strategy:
66
fail-fast: false
77
matrix:
88
os: [ ubuntu-latest, macos-latest ]
9-
ruby: [ '2.7', '3.0' ]
9+
ruby: [ '3.3', '3.4' ]
1010
runs-on: ${{ matrix.os }}
1111

1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: ruby/setup-ruby@v1
13+
- name: Check out repository
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Ruby
17+
uses: ruby/setup-ruby@v1
1518
with:
1619
ruby-version: ${{ matrix.ruby }}
1720
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
18-
- run: bundle exec rake
21+
22+
- name: Run checks
23+
run: bundle exec rake
24+
25+
- name: Upload artifacts
26+
if: ${{ always() }}
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: artifacts-${{ matrix.ruby }}-${{ matrix.os }}
30+
path: artifacts/**

.github/workflows/gem-push.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Ruby Gem
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
name: Build + Publish
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up Ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: '3.3'
22+
bundler-cache: true
23+
24+
- name: Publish to RubyGems
25+
run: |
26+
mkdir -p $HOME/.gem
27+
touch $HOME/.gem/credentials
28+
chmod 0600 $HOME/.gem/credentials
29+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
30+
gem build *.gemspec
31+
gem push *.gem
32+
env:
33+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"

0 commit comments

Comments
 (0)