-
Notifications
You must be signed in to change notification settings - Fork 18
251 lines (240 loc) · 11.1 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
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 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() }}
react_native_ios:
if: github.ref == 'refs/heads/master'
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_14.3.1.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/ios
run: pod install
- 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.ref == 'refs/heads/master'
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.ref == 'refs/heads/master'
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_14.3.1.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 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.ref == 'refs/heads/master'
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 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"