-
-
Notifications
You must be signed in to change notification settings - Fork 28
161 lines (149 loc) · 4.87 KB
/
default.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---
name: CI/CD
on:
push:
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
ruby_versions: [2.7, 3.0, 3.1, 3.2]
steps:
- uses: actions/checkout@v3
- name: Set up Ruby ${{ matrix.ruby_versions }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_versions }}
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gems-
- name: Install Bundler
run: gem install bundler
- name: Configure Bundler
run: bundle config path vendor/bundle
- name: Bundle Install
run: bundle install --jobs 4 --retry 3
- name: Set APP_STORE_CONNECT_VERSION
run: echo "APP_STORE_CONNECT_VERSION=$(bundle exec rake version:current)" >> $GITHUB_ENV
- name: Build
run: bundle exec rake build
- name: Upload Gem
uses: actions/upload-artifact@v3
with:
name: app_store_connect-${{ env.APP_STORE_CONNECT_VERSION }}.gem
path: app_store_connect-${{ env.APP_STORE_CONNECT_VERSION }}.gem
lint:
name: Lint
runs-on: ubuntu-latest
needs: [build]
strategy:
matrix:
ruby_versions: [2.7, 3.0, 3.1, 3.2]
steps:
- uses: actions/checkout@v3
- name: Set up Ruby ${{ matrix.ruby_versions }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_versions }}
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gems-
- name: Install Bundler
run: gem install bundler
- name: Configure Bundler
run: bundle config path vendor/bundle
- name: Bundle Install
run: bundle install --jobs 4 --retry 3
- name: Run Rubocop
run: bundle exec rubocop
test:
name: Test
runs-on: ubuntu-latest
needs: [build]
strategy:
matrix:
ruby_versions: [2.7, 3.0, 3.1, 3.2]
steps:
- uses: actions/checkout@v3
- name: Set up Ruby ${{ matrix.ruby_versions }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_versions }}
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gems-
- name: Install Bundler
run: gem install bundler
- name: Configure Bundler
run: bundle config path vendor/bundle
- name: Bundle Install
run: bundle install --jobs 4 --retry 3
- name: Run RSpec
run: bundle exec rake spec
release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: [test, lint]
steps:
- uses: actions/checkout@v3
- name: Set up Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gems-
- name: Install Bundler
run: gem install bundler
- name: Configure Bundler
run: bundle config path vendor/bundle
- name: Configure Gem
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${{secrets.RUBYGEMS_API_KEY}}\n:github: Bearer ${{secrets.PERSONAL_ACCESS_TOKEN}}" > $HOME/.gem/credentials
- name: Bundle Install
run: bundle install --jobs 4 --retry 3
- name: Set APP_STORE_CONNECT_VERSION
run: echo "APP_STORE_CONNECT_VERSION=$(bundle exec rake version:current)" >> $GITHUB_ENV
- uses: actions/download-artifact@v3
with:
name: app_store_connect-${{ env.APP_STORE_CONNECT_VERSION }}.gem
path: /tmp
- run: mv /tmp/app_store_connect-${{ env.APP_STORE_CONNECT_VERSION }}.gem .
- name: Push Gem to Rubygems
run: bundle exec rake push[rubygems]
continue-on-error: true
- name: Push Gem to Github Package Registry
run: bundle exec rake push[github]
continue-on-error: true
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app_store_connect-${{ env.APP_STORE_CONNECT_VERSION }}.gem
asset_name: app_store_connect-${{ env.APP_STORE_CONNECT_VERSION }}.gem
asset_content_type: application/binary