-
Notifications
You must be signed in to change notification settings - Fork 3
343 lines (298 loc) · 14.1 KB
/
app_stg.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
name: Generate Test React STG
on:
workflow_dispatch:
inputs:
ref:
default: main
description: "Git Tag, Branch or SHA to build"
required: true
secrets:
BUILD_USER_PAT:
required: true
pull_request:
types:
- closed
branches:
- main
secrets:
BUILD_USER_PAT:
required: true
jobs:
build-android-stg:
name: Generate Play Store STG
permissions:
actions: write
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v2
with:
path: source
ref: '${{ inputs.ref }}'
- name: Install Google API python client
run: |
pip install google-api-python-client
- name: Get new version code
run: |
echo $GOOGLE_PLAY_SERVICE_ACCOUNT > $RUNNER_TEMP/.service_account
python3 build-utils/get_version_code.py $RUNNER_TEMP/.service_account com.namiml.stg.testreactnative internal --quiet >> $RUNNER_TEMP/.new_version_code
rm -f .service_account
env:
GOOGLE_PLAY_SERVICE_ACCOUNT: '${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}'
working-directory: source
- name: Update version code
working-directory: source/examples/Basic/android/app
run: |
NEW_VERSION_CODE=`cat $RUNNER_TEMP/.new_version_code`
echo $NEW_VERSION_CODE
sed -i "s/versionCode 1/versionCode $NEW_VERSION_CODE/" build.gradle
- name: Update App Platform ID
working-directory: source/examples/Basic/config/
run: |
sed -i "s/ANDROID_STG_APP_PLATFORM_ID/$BASIC_ANDROID_STG_APP_PLATFORM_ID/" index.ts
env:
BASIC_ANDROID_STG_APP_PLATFORM_ID: '${{ secrets.ANDROID_STG_APP_PLATFORM_ID }}'
- name: Create the Keystore
run: |
# import keystore from secrets
echo $KEYSTORE_BASE64 | base64 -d > $RUNNER_TEMP/my_production.keystore
env:
KEYSTORE_BASE64: '${{ secrets.KEY_STORE_BASE64 }}'
- name: Install test app dependencies
run: |
yarn install
working-directory: source/examples/Basic
- name: Manually create the bundle
run: |
mkdir -p android/app/src/main/assets/
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle
working-directory: source/examples/Basic
- name: Build Android App Bundle
run: |
./gradlew clean bundleStagingRelease
working-directory: source/examples/Basic/android
- name: Sign Android App Bundle
run: |
jarsigner -keystore $RUNNER_TEMP/my_production.keystore -storepass '${{ secrets.KEY_STORE_PASSWORD }}' -keypass '${{ secrets.KEY_PASSWORD }}' -sigalg SHA256withRSA -digestalg SHA-256 -signedjar build/outputs/bundle/stagingRelease/app-staging-release-signed.aab build/outputs/bundle/stagingRelease/app-staging-release.aab '${{ secrets.KEY_ALIAS }}'
working-directory: source/examples/Basic/android/app
- name: Uploading to test track
uses: r0adkll/[email protected]
with:
packageName: 'com.namiml.stg.testreactnative'
releaseFiles: source/examples/Basic/android/app/build/outputs/bundle/stagingRelease/app-staging-release-signed.aab
serviceAccountJsonPlainText: '${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}'
status: completed
track: internal
build-ios-stg:
name: Generate Apple STG
permissions:
actions: write
contents: write
id-token: write
runs-on: macos-12
timeout-minutes: 40
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: "Checkout ${{ inputs.ref }}"
uses: actions/checkout@v2
with:
path: source
ref: "${{ inputs.ref }}"
- name: Checkout appstoreconnect-build-tools
uses: actions/checkout@v2
with:
path: appstoreconnect-build-tools
ref: main
repository: namiml/appstoreconnect-build-tools
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Get expected build number
run: |
pip3 install requests
pip3 install pydantic==1.10.11
pip3 install cryptography
pip3 install PyJWT
echo "1.0" > $RUNNER_TEMP/.current_version
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version`
python3 get_next_build.py com.namiml.stg.testreactnative --prerelease --version=$CURRENT_VERSION --platform=IOS > $RUNNER_TEMP/.next_build_number
working-directory: appstoreconnect-build-tools
env:
APPSTORE_API_KEY_ID: "${{ secrets.APPSTORE_API_KEY_ID }}"
APPSTORE_API_PRIVATE_KEY: "${{ secrets.APPSTORE_API_PRIVATE_KEY }}"
APPSTORE_ISSUER_ID: "${{ secrets.APPSTORE_ISSUER_ID }}"
- name: Install Apple Certificate
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: "${{ secrets.IOS_P12_BASE64 }}"
p12-password: "${{ secrets.IOS_CERTIFICATE_PASSWORD }}"
- name: Install the provisioning profile
run: |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode --output $PP_PATH
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
env:
PROVISIONING_CERTIFICATE_BASE64: "${{ secrets.IOS_MOBILE_PROVISION_BASE64_TEST_REACT_STG }}"
- name: Store App Store Private Key
run: |
mkdir ~/.private_keys
echo '${{ secrets.APPSTORE_API_PRIVATE_KEY }}' > ~/.private_keys/AuthKey_'${{ secrets.APPSTORE_API_KEY_ID }}'.p8
- name: Update ExportOptions.plist
run: |
sed -i '' -e "s/APPSTORE_TEAM_ID/${{ secrets.APPSTORE_TEAM_ID }}/" ExportOptions.plist
sed -i '' -e "s/APPSTORE_PROVISIONING_PROFILE_UUID/${{ secrets.APPSTORE_PROV_PROFILE_UUID_TEST_REACT_STG }}/g" ExportOptions.plist
working-directory: source/examples/Basic/ios
- name: Adjust version & build number
run: |-
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version`
export BUILD_NUMBER=`cat $RUNNER_TEMP/.next_build_number`
sed -i '' -e "s/CURRENT_PROJECT_VERSION = 1/CURRENT_PROJECT_VERSION = $BUILD_NUMBER/" ios/Basic.xcodeproj/project.pbxproj
sed -i '' -e "s/MARKETING_VERSION = 1.0/MARKETING_VERSION = $CURRENT_VERSION/" ios/Basic.xcodeproj/project.pbxproj
sed -i '' -e "s/<string>1<\/string>/<string>$BUILD_NUMBER<\/string>/" ios/Basic/Info.plist
working-directory: source/examples/Basic
- name: Install test app dependencies
run: |
yarn install
working-directory: source/examples/Basic
- name: Update App Platform ID
working-directory: source/examples/Basic/config/
run: |
sed -i '' -e "s/APPLE_STG_APP_PLATFORM_ID/$BASIC_APPLE_STG_APP_PLATFORM_ID/" index.ts
env:
BASIC_APPLE_STG_APP_PLATFORM_ID: '${{ secrets.APPLE_STG_APP_PLATFORM_ID }}'
- name: Install test iOS dependencies
run: |
pod install --repo-update
working-directory: source/examples/Basic/ios
- name: Build resolve Swift dependencies
run: |
xcodebuild -resolvePackageDependencies -workspace ios/Basic.xcworkspace -scheme Basic -configuration Release
working-directory: source/examples/Basic
- name: Build xArchive
run: |
xcodebuild -workspace ios/Basic.xcworkspace -scheme Basic -configuration Release DEVELOPMENT_TEAM='${{ secrets.APPSTORE_TEAM_ID }}' -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app-stg.xcarchive PROVISIONING_PROFILE='${{ secrets.APPSTORE_PROV_PROFILE_UUID_TEST_REACT_STG }}' clean archive CODE_SIGN_IDENTITY='${{ secrets.CODE_SIGNING_IDENTITY }}'
working-directory: source/examples/Basic
- name: Export IPA
run: |
xcodebuild -exportArchive -archivePath build-output/app-stg.xcarchive -exportPath build-output/ios-stg -exportOptionsPlist ios/ExportOptions.plist
working-directory: source/examples/Basic
- name: Upload app to TestFlight
run: |
xcrun altool --upload-app --type ios --file build-output/ios-stg/Basic.ipa --apiKey $APPSTORE_API_KEY_ID --apiIssuer $APPSTORE_ISSUER_ID
working-directory: source/examples/Basic
env:
APPSTORE_API_KEY_ID: "${{ secrets.APPSTORE_API_KEY_ID }}"
APPSTORE_ISSUER_ID: "${{ secrets.APPSTORE_ISSUER_ID }}"
build-tvos-stg:
name: Build TestNamiTV tvOS STG
permissions:
actions: write
contents: write
id-token: write
runs-on: macos-12
timeout-minutes: 40
steps:
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: "Checkout ${{ inputs.ref }}"
uses: actions/checkout@v2
with:
path: source
ref: "${{ inputs.ref }}"
- name: Checkout appstoreconnect-build-tools
uses: actions/checkout@v2
with:
path: appstoreconnect-build-tools
ref: main
repository: namiml/appstoreconnect-build-tools
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Get expected build number
run: |
pip3 install requests
pip3 install pydantic==1.10.11
pip3 install cryptography
pip3 install PyJWT
echo "1.0" > $RUNNER_TEMP/.current_version
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version`
python3 get_next_build.py com.namiml.stg.testreactnative --prerelease --platform=TV_OS > $RUNNER_TEMP/.next_build_number
working-directory: appstoreconnect-build-tools
env:
APPSTORE_API_KEY_ID: "${{ secrets.APPSTORE_API_KEY_ID }}"
APPSTORE_API_PRIVATE_KEY: "${{ secrets.APPSTORE_API_PRIVATE_KEY }}"
APPSTORE_ISSUER_ID: "${{ secrets.APPSTORE_ISSUER_ID }}"
- name: Install Apple Certificate
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: "${{ secrets.IOS_P12_BASE64 }}"
p12-password: "${{ secrets.IOS_CERTIFICATE_PASSWORD }}"
- name: Install the provisioning profile
run: |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode --output $PP_PATH
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
env:
PROVISIONING_CERTIFICATE_BASE64: "${{ secrets.IOS_MOBILE_PROVISION_BASE64_TEST_REACT_TVOS_STG }}"
- name: Store App Store Private Key
run: |
mkdir ~/.private_keys
echo '${{ secrets.APPSTORE_API_PRIVATE_KEY }}' > ~/.private_keys/AuthKey_'${{ secrets.APPSTORE_API_KEY_ID }}'.p8
- name: Update ExportOptions.plist
run: |
sed -i '' -e "s/APPSTORE_TEAM_ID/${{ secrets.APPSTORE_TEAM_ID }}/" ExportOptions.plist
sed -i '' -e "s/APPSTORE_PROVISIONING_PROFILE_UUID/${{ secrets.APPSTORE_PROV_PROFILE_UUID_TEST_REACT_TVOS_STG }}/g" ExportOptions.plist
working-directory: source/examples/TestNamiTV/ios
- name: Adjust version & build number
run: |-
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version`
export BUILD_NUMBER=`cat $RUNNER_TEMP/.next_build_number`
sed -i '' -e "s/CURRENT_PROJECT_VERSION = 1/CURRENT_PROJECT_VERSION = $BUILD_NUMBER/" ios/Basic.xcodeproj/project.pbxproj
sed -i '' -e "s/MARKETING_VERSION = 1.0/MARKETING_VERSION = $CURRENT_VERSION/" ios/Basic.xcodeproj/project.pbxproj
sed -i '' -e "s/<string>1<\/string>/<string>$BUILD_NUMBER<\/string>/" ios/Info-STG.plist
working-directory: source/examples/TestNamiTV
- name: Install test app dependencies
run: |
yarn install
working-directory: source/examples/TestNamiTV
- name: Update App Platform ID
working-directory: source/examples/TestNamiTV/config/
run: |
sed -i '' -e "s/APPLE_STAGE_APP_PLATFORM_ID/$TESTNAMITV_APPLE_STG_APP_PLATFORM_ID/" index.ts
env:
TESTNAMITV_APPLE_STG_APP_PLATFORM_ID: '${{ secrets.APPLE_STG_APP_PLATFORM_ID }}'
- name: Install test tvOS dependencies
run: |
RCT_NEW_ARCH_ENABLED=0 SWIFT_VERSION=5 pod install --repo-update
working-directory: source/examples/TestNamiTV/ios
- name: Build resolve Swift dependencies
run: |
xcodebuild -resolvePackageDependencies -workspace ios/Basic.xcworkspace -scheme Basic-tvOS -configuration Release
working-directory: source/examples/TestNamiTV
- name: Build xArchive
run: |
xcodebuild -workspace ios/Basic.xcworkspace -scheme Basic-tvOS -configuration Release DEVELOPMENT_TEAM='${{ secrets.APPSTORE_TEAM_ID }}' -sdk 'appletvos' -destination 'generic/platform=tvOS' -archivePath build-output/app-stg.xcarchive PROVISIONING_PROFILE='${{ secrets.APPSTORE_PROV_PROFILE_UUID_TEST_REACT_TVOS_STG }}' clean archive CODE_SIGN_IDENTITY='${{ secrets.CODE_SIGNING_IDENTITY }}'
working-directory: source/examples/TestNamiTV
- name: Export IPA
run: |
xcodebuild -exportArchive -archivePath build-output/app-stg.xcarchive -exportPath build-output/tvos-stg -exportOptionsPlist ios/ExportOptions.plist
working-directory: source/examples/TestNamiTV
- name: Upload app to TestFlight
run: |
xcrun altool --upload-app --type tvos --file build-output/tvos-stg/Basic-tvOS.ipa --apiKey $APPSTORE_API_KEY_ID --apiIssuer $APPSTORE_ISSUER_ID
working-directory: source/examples/TestNamiTV
env:
APPSTORE_API_KEY_ID: "${{ secrets.APPSTORE_API_KEY_ID }}"
APPSTORE_ISSUER_ID: "${{ secrets.APPSTORE_ISSUER_ID }}"