-
Notifications
You must be signed in to change notification settings - Fork 18
353 lines (338 loc) · 15.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
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
name: CI
on:
push:
branches:
- '*'
- '!gh-pages'
pull_request:
branches:
- '*'
- '!gh-pages'
jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: "./.tool-versions"
- 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 format
if: ${{ !cancelled() }}
- run: npm run lint
if: ${{ !cancelled() }}
- run: npm run typecheck
if: ${{ !cancelled() }}
- run: npm run test
if: ${{ !cancelled() }}
- run: npm run bundle
if: ${{ !cancelled() }}
- run: make docs
if: ${{ !cancelled() }}
webapp-image:
runs-on: ubuntu-22.04
needs: test
steps:
- uses: actions/checkout@v3
- run: make build-image
- uses: docker/login-action@v2
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-13-Readme.md
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: "./.tool-versions"
- run: npm ci
- run: npm run build
- working-directory: ./example/reactnative
run: yarn
- name: Build unsigned APK
working-directory: ./example/reactnative/android
run: ./gradlew :app:assembleRelease
test_capacitor_ios:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: "./.tool-versions"
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- run: npm ci
- run: npm run build
- working-directory: ./example/capacitor
run: npm ci
- working-directory: ./example/capacitor
run: npm run build
- working-directory: ./example/capacitor
run: npx cap sync
- name: Run xcodebuild
working-directory: ./example/capacitor/ios/App
run: xcodebuild -quiet -workspace App.xcworkspace -scheme App -sdk iphonesimulator build
test_capacitor_android:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: "./.tool-versions"
- run: npm ci
- run: npm run build
- working-directory: ./example/capacitor
run: npm ci
- working-directory: ./example/capacitor
run: npm run build
- working-directory: ./example/capacitor
run: npx cap sync
- name: Build unsigned APK
working-directory: ./example/capacitor/android
run: ./gradlew :app:assembleRelease
react_native_ios:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.ref == 'refs/heads/master' && 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-13-Readme.md
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
# Do not specify ruby-version so that it picks the version declared in .tool-versions
# See https://github.com/ruby/setup-ruby?tab=readme-ov-file#supported-version-syntax
# ruby-version: "Unspecified intentionally. See the above comment"
# 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
bundler-cache: false
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- run: npm install -g appcenter-cli
- run: npm ci
- run: npm run build
- working-directory: ./example/reactnative
run: yarn
- working-directory: ./example/reactnative
# Install cocoapods from the Gemfile
run: bundle install
- working-directory: ./example/reactnative
# Run the specific cocoapods
run: bundle exec pod install --project-directory=ios
- name: Install the Apple certificate and provisioning profile
env:
IOS_CERTIFICATE_BASE64: ${{ secrets.REACT_NATIVE_IOS_CERTIFICATE_BASE64 }}
IOS_PROVISIONING_PROFILE_BASE64: ${{ secrets.REACT_NATIVE_IOS_PROVISIONING_PROFILE_BASE64 }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$IOS_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$IOS_PROVISIONING_PROFILE_BASE64" | base64 --decode -o $PP_PATH
security create-keychain -p "" $KEYCHAIN_PATH
security set-keychain-settings $KEYCHAIN_PATH
security unlock-keychain -p "" $KEYCHAIN_PATH
security import $CERTIFICATE_PATH -P "" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Set CFBundleVersion
working-directory: ./example/reactnative/ios
run: |
BUILD_NUMBER=$(date +%s)
/usr/libexec/Plistbuddy -c "Set CFBundleVersion $BUILD_NUMBER" ./reactNativeExample/Info.plist
- name: Run xcodebuild archive
working-directory: ./example/reactnative/ios
run: xcodebuild -workspace reactNativeExample.xcworkspace -scheme reactNativeExample -configuration Release -archivePath "$RUNNER_TEMP/reactNativeExample.xcarchive" archive
- name: Run xcodebuild -exportArchive
working-directory: ./example/reactnative/ios
run: xcodebuild -exportArchive -archivePath "$RUNNER_TEMP/reactNativeExample.xcarchive" -exportPath "$RUNNER_TEMP/reactNativeExample.export" -exportOptionsPlist "./ExportOptions.plist"
- name: Distribute to App Center
env:
APPCENTER_ACCESS_TOKEN: ${{ secrets.REACT_NATIVE_IOS_APPCENTER_ACCESS_TOKEN }}
run: appcenter distribute release --debug --silent --file "$RUNNER_TEMP/reactNativeExample.export/reactNativeExample.ipa" --store "App Store Connect Users" --app "Oursky/Authgear-demo-RN-iOS" --release-notes "no release notes"
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
react_native_android:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.ref == 'refs/heads/master' && 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-13-Readme.md
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: "./.tool-versions"
- run: npm install -g appcenter-cli
- run: npm ci
- run: npm run build
- working-directory: ./example/reactnative
run: yarn
- name: Set versionCode
run: |
VERSION_CODE=$(date +%s)
sed -I "" "s/versionCode 1/versionCode $VERSION_CODE/" ./example/reactnative/android/app/build.gradle
- name: Build unsigned APK
working-directory: ./example/reactnative/android
run: ./gradlew :app:assembleRelease
- name: Install keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.REACT_NATIVE_ANDROID_KEYSTORE_BASE64 }}
run: |
KEYSTORE_PATH=$RUNNER_TEMP/keystore.jks
echo -n "$ANDROID_KEYSTORE_BASE64" | base64 --decode -o $KEYSTORE_PATH
- name: Run zipalign
run: |
"$ANDROID_HOME/build-tools/33.0.2/zipalign" -c -v 4 ./example/reactnative/android/app/build/outputs/apk/release/app-release-unsigned.apk
- name: Run apksigner
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.REACT_NATIVE_ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.REACT_NATIVE_ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.REACT_NATIVE_ANDROID_KEY_PASSWORD }}
run: |
"$ANDROID_HOME/build-tools/33.0.2/apksigner" sign \
--ks $RUNNER_TEMP/keystore.jks \
--ks-key-alias "$ANDROID_KEY_ALIAS" \
--ks-pass "pass:$ANDROID_KEYSTORE_PASSWORD" \
--key-pass "pass:$ANDROID_KEY_PASSWORD" \
--out ./example/reactnative/android/app/build/outputs/apk/release/app-release-signed.apk \
./example/reactnative/android/app/build/outputs/apk/release/app-release-unsigned.apk
- name: Distribute to App Center
env:
APPCENTER_ACCESS_TOKEN: ${{ secrets.REACT_NATIVE_ANDROID_APPCENTER_ACCESS_TOKEN }}
run: appcenter distribute release --debug --silent --file ./example/reactnative/android/app/build/outputs/apk/release/app-release-signed.apk --group "Collaborators" --app "Oursky/Authgear-demo-RN-Android" --release-notes "no release notes"
capacitor_ios:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
needs: test
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: "./.tool-versions"
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- run: npm install -g appcenter-cli
- run: npm ci
- run: npm run build
- working-directory: ./example/capacitor
run: npm ci
- working-directory: ./example/capacitor
run: npm audit
- working-directory: ./example/capacitor
run: npm run build
- working-directory: ./example/capacitor
run: npx cap sync
- name: Install the Apple certificate and provisioning profile
env:
IOS_CERTIFICATE_BASE64: ${{ secrets.CAPACITOR_IOS_CERTIFICATE_BASE64 }}
IOS_PROVISIONING_PROFILE_BASE64: ${{ secrets.CAPACITOR_IOS_PROVISIONING_PROFILE_BASE64 }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$IOS_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$IOS_PROVISIONING_PROFILE_BASE64" | base64 --decode -o $PP_PATH
security create-keychain -p "" $KEYCHAIN_PATH
security set-keychain-settings $KEYCHAIN_PATH
security unlock-keychain -p "" $KEYCHAIN_PATH
security import $CERTIFICATE_PATH -P "" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Set CFBundleVersion
working-directory: ./example/capacitor/ios/App
run: |
BUILD_NUMBER=$(date +%s)
/usr/libexec/Plistbuddy -c "Set CFBundleVersion $BUILD_NUMBER" ./App/Info.plist
- name: Run xcodebuild archive
working-directory: ./example/capacitor/ios/App
run: xcodebuild -workspace App.xcworkspace -scheme App -configuration Release -archivePath "$RUNNER_TEMP/App.xcarchive" archive
- name: Run xcodebuild -exportArchive
working-directory: ./example/capacitor/ios/App
run: xcodebuild -exportArchive -archivePath "$RUNNER_TEMP/App.xcarchive" -exportPath "$RUNNER_TEMP/App.export" -exportOptionsPlist "./ExportOptions.plist"
- name: Distribute to App Center
env:
APPCENTER_ACCESS_TOKEN: ${{ secrets.CAPACITOR_IOS_APPCENTER_ACCESS_TOKEN }}
run: appcenter distribute release --debug --silent --file "$RUNNER_TEMP/App.export/App.ipa" --store "App Store Connect Users" --app "Oursky/Authgear-Demo-Capacitor-iOS" --release-notes "no release notes"
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
capacitor_android:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
needs: test
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: "./.tool-versions"
- run: npm install -g appcenter-cli
- run: npm ci
- run: npm run build
- working-directory: ./example/capacitor
run: npm ci
- working-directory: ./example/capacitor
run: npm audit
- working-directory: ./example/capacitor
run: npm run build
- working-directory: ./example/capacitor
run: npx cap sync
- name: Set versionCode
run: |
VERSION_CODE=$(date +%s)
sed -I "" "s/versionCode 1/versionCode $VERSION_CODE/" ./example/capacitor/android/app/build.gradle
- name: Build unsigned APK
working-directory: ./example/capacitor/android
run: ./gradlew :app:assembleRelease
- name: Install keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.CAPACITOR_ANDROID_KEYSTORE_BASE64 }}
run: |
KEYSTORE_PATH=$RUNNER_TEMP/keystore.jks
echo -n "$ANDROID_KEYSTORE_BASE64" | base64 --decode -o $KEYSTORE_PATH
- name: Run zipalign
run: |
"$ANDROID_HOME/build-tools/33.0.2/zipalign" -c -v 4 ./example/capacitor/android/app/build/outputs/apk/release/app-release-unsigned.apk
- name: Run apksigner
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.CAPACITOR_ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.CAPACITOR_ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.CAPACITOR_ANDROID_KEY_PASSWORD }}
run: |
"$ANDROID_HOME/build-tools/33.0.2/apksigner" sign \
--ks $RUNNER_TEMP/keystore.jks \
--ks-key-alias "$ANDROID_KEY_ALIAS" \
--ks-pass "pass:$ANDROID_KEYSTORE_PASSWORD" \
--key-pass "pass:$ANDROID_KEY_PASSWORD" \
--out ./example/capacitor/android/app/build/outputs/apk/release/app-release-signed.apk \
./example/capacitor/android/app/build/outputs/apk/release/app-release-unsigned.apk
- name: Distribute to App Center
env:
APPCENTER_ACCESS_TOKEN: ${{ secrets.CAPACITOR_ANDROID_APPCENTER_ACCESS_TOKEN }}
run: appcenter distribute release --debug --silent --file ./example/capacitor/android/app/build/outputs/apk/release/app-release-signed.apk --group "Collaborators" --app "Oursky/Authgear-Demo-Capacitor-Android" --release-notes "no release notes"