-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (75 loc) · 2.2 KB
/
ci.yaml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: CI
on: push
jobs:
release-please:
name: Release Please
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}
tag_name: ${{ steps.release-please.outputs.tag_name }} # e.g. v1.0.0
version: ${{ steps.release-please.outputs.version }} # e.g. 1.0.0
steps:
- uses: tibdex/github-app-token@v1
id: generate-github-token
with:
app_id: ${{ vars.RELEASE_PLEASE_GITHUB_APP_ID }}
private_key: ${{ secrets.RELEASE_PLEASE_GITHUB_APP_PRIVATE_KEY }}
- uses: krystal/release-please-manifest-action@v1
id: release-please
with:
token: ${{ steps.generate-github-token.outputs.token }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
- name: Install dependencies
run: bundle install
- name: Run linter
run: bin/rubocop
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby_version:
- 2.7
- 3.0
- 3.1
- 3.2
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
- name: Install dependencies
run: bundle install
- name: Run tests
run: bin/rspec
release:
name: Publish to RubyGems
runs-on: ubuntu-latest
needs: [release-please, test, lint]
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@master
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
- name: Build Gem
run: gem build *.gemspec
- name: Setup credentials
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
env:
RUBYGEMS_API_KEY: ${{secrets.KRYSTAL_RUBYGEMS_API_KEY}}
- name: Publish to RubyGems
run: |
gem push *.gem