-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (56 loc) · 1.53 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
name: Pipeline
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-22.04
strategy:
matrix:
ruby-version: [3.0.6, 3.1.4, 3.2.2]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby-version }}
- name: Lint
run: bundle exec rubocop
- name: Test
run: bundle exec rspec
# Separate `release` job from `build`, as we only want release to be run once
# and not run for each ruby version in the matrix:
release:
name: Release
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Release the gem
run: |
mkdir -p ~/.gem
cat << EOF > ~/.gem/credentials
---
:github: Bearer ${GITHUB_TOKEN}
:rubygems_api_key: ${RUBYGEMS_API_KEY}
EOF
chmod 0600 ~/.gem/credentials
git config user.email "[email protected]"
git config user.name "Wolfbot"
bundle exec rake release
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}