-
Notifications
You must be signed in to change notification settings - Fork 21
288 lines (274 loc) · 10.1 KB
/
ci.yaml
File metadata and controls
288 lines (274 loc) · 10.1 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
## Why do we specify bundler-cache: false?
##
## Ideally we should turn this on.
## But this flag runs bundle install and cache, which does not suit our use case here.
## See https://github.com/ruby/setup-ruby?tab=readme-ov-file#caching-bundle-install-automatically
name: CI
on:
push:
branches:
- '*'
- '!gh-pages'
tags:
- '*'
pull_request:
branches:
- '*'
- '!gh-pages'
# https://docs.npmjs.com/trusted-publishers#step-2-configure-your-cicd-workflow
permissions:
id-token: write
contents: read
jobs:
test:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: node --version
- run: npm --version
- run: make ruby-audit
- run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
- run: npm ci
- run: npm ci
working-directory: ./website
- run: npm audit
if: ${{ !cancelled() }}
- run: npm audit
working-directory: ./website
if: ${{ !cancelled() }}
- run: npm run check-tidy
if: ${{ !cancelled() }}
- run: npm run format
if: ${{ !cancelled() }}
- run: npm run lint
if: ${{ !cancelled() }}
- run: npm run typecheck
if: ${{ !cancelled() }}
- run: npm run test
if: ${{ !cancelled() }}
- run: npm run verify
if: ${{ !cancelled() }}
- run: npm run build
if: ${{ !cancelled() }}
- run: make docs
if: ${{ !cancelled() }}
publish:
if: ${{ github.ref_type == 'tag' }}
runs-on: macos-15
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version-file: "./.tool-versions"
- run: node --version
- run: npm --version
- run: npm ci
- run: npm run build
- run: ../../scripts/npm-publish.sh
working-directory: ./packages/authgear-web/
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
- run: ../../scripts/npm-publish.sh
working-directory: ./packages/authgear-react-native/
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
- run: ../../scripts/npm-publish.sh
working-directory: ./packages/authgear-capacitor/
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
webapp-image:
runs-on: ubuntu-24.04
needs: test
steps:
- uses: actions/checkout@v4
- run: make build-image
- uses: docker/login-action@v3
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.event_name == 'push' }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- run: make push-image
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.event_name == 'push' }}
# react_native_ios cannot be built on simulator due to WeChat SDK
test_react_native_android:
# When we change the runner image, the available Android build tools versions will also change.
# We need to update build.gradle too.
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-15-arm64-Readme.md
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version-file: "./.tool-versions"
- run: make sdk-build
- run: make react-native-npm-ci
- run: make react-native-build-unsigned-aab
test_capacitor_ios:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
- run: make sdk-build
- run: make capacitor-npm-ci
- run: make capacitor-build-js
- run: make capacitor-build-ios-simulator
test_capacitor_android:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version-file: "./.tool-versions"
- run: make sdk-build
- run: make capacitor-npm-ci
- run: make capacitor-build-js
- run: make capacitor-build-unsigned-aab
react_native_ios:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.event_name == 'push' }}
needs: test
# When we change the runner image, the ruby version will change too.
# We need to update .tool-versions to make them the same.
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-15-arm64-Readme.md
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
- run: make sdk-build
- run: make react-native-npm-ci
- run: make react-native-pod-install
- uses: authgear/gh-actions-install-apple-certificate-and-provisioning-profile@v1
with:
certificate_base64: ${{ secrets.REACT_NATIVE_IOS_CERTIFICATE_BASE64 }}
certificate_password: ${{ secrets.REACT_NATIVE_IOS_CERTIFICATE_PASSWORD }}
provisioning_profile_base64: ${{ secrets.REACT_NATIVE_IOS_PROVISIONING_PROFILE_BASE64 }}
- uses: authgear/gh-actions-create-fastlane-api-key-json-file@v1
with:
api_key_id: ${{ secrets.IOS_API_KEY_ID }}
api_key_issuer: ${{ secrets.IOS_API_KEY_ISSUER }}
api_key_base64: ${{ secrets.IOS_API_KEY_BASE64 }}
output_path: ./build/fastlane-api-key.json
- run: make react-native-build-ios-app
- name: Upload to TestFlight
if: ${{ github.ref == 'refs/heads/master' }}
run: make react-native-upload-ios-app
react_native_android:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.event_name == 'push' }}
needs: test
# When we change the runner image, the available Android build tools versions will also change.
# We need to update build.gradle too.
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-15-arm64-Readme.md
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: make sdk-build
- run: make react-native-npm-ci
- name: Build aab
env:
STORE_BASE64: ${{ secrets.REACT_NATIVE_ANDROID_KEYSTORE_BASE64 }}
STORE_PASSWORD: ${{ secrets.REACT_NATIVE_ANDROID_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.REACT_NATIVE_ANDROID_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.REACT_NATIVE_ANDROID_KEY_PASSWORD }}
run: |
export STORE_FILE="$RUNNER_TEMP/upload_key.jks"
echo -n "$STORE_BASE64" | base64 --decode -o "$STORE_FILE"
make react-native-build-aab
- name: Upload aab
if: ${{ github.ref == 'refs/heads/master' }}
env:
GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64 }}
run: |
export GOOGLE_SERVICE_ACCOUNT_KEY_JSON_FILE="$RUNNER_TEMP/google_service_account_key.json"
echo -n "$GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64" | base64 --decode -o "$GOOGLE_SERVICE_ACCOUNT_KEY_JSON_FILE"
make react-native-upload-aab
capacitor_ios:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.event_name == 'push' }}
needs: test
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
- run: make sdk-build
- run: make capacitor-npm-ci
- run: make capacitor-npm-audit
- run: make capacitor-build-js
- uses: authgear/gh-actions-install-apple-certificate-and-provisioning-profile@v1
with:
certificate_base64: ${{ secrets.CAPACITOR_IOS_CERTIFICATE_BASE64 }}
certificate_password: ${{ secrets.CAPACITOR_IOS_CERTIFICATE_PASSWORD }}
provisioning_profile_base64: ${{ secrets.CAPACITOR_IOS_PROVISIONING_PROFILE_BASE64 }}
- uses: authgear/gh-actions-create-fastlane-api-key-json-file@v1
with:
api_key_id: ${{ secrets.IOS_API_KEY_ID }}
api_key_issuer: ${{ secrets.IOS_API_KEY_ISSUER }}
api_key_base64: ${{ secrets.IOS_API_KEY_BASE64 }}
output_path: ./build/fastlane-api-key.json
- run: make capacitor-build-ios-app
- name: Upload to TestFlight
if: ${{ github.ref == 'refs/heads/master' }}
run: make capacitor-upload-ios-app
capacitor_android:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.event_name == 'push' }}
needs: test
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: make sdk-build
- run: make capacitor-npm-ci
- run: make capacitor-npm-audit
- run: make capacitor-build-js
- name: Build aab
env:
STORE_BASE64: ${{ secrets.CAPACITOR_ANDROID_KEYSTORE_BASE64 }}
STORE_PASSWORD: ${{ secrets.CAPACITOR_ANDROID_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.CAPACITOR_ANDROID_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.CAPACITOR_ANDROID_KEY_PASSWORD }}
run: |
export STORE_FILE="$RUNNER_TEMP/upload_key.jks"
echo -n "$STORE_BASE64" | base64 --decode -o "$STORE_FILE"
make capacitor-build-aab
- name: Upload aab
if: ${{ github.ref == 'refs/heads/master' }}
env:
GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64 }}
run: |
export GOOGLE_SERVICE_ACCOUNT_KEY_JSON_FILE="$RUNNER_TEMP/google_service_account_key.json"
echo -n "$GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64" | base64 --decode -o "$GOOGLE_SERVICE_ACCOUNT_KEY_JSON_FILE"
make capacitor-upload-aab