-
Notifications
You must be signed in to change notification settings - Fork 12
395 lines (346 loc) · 14.8 KB
/
ios.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
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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
name: Meowbili iDevice Workflow
on:
push:
branches: [ "main", "2024" ]
paths-ignore:
- '.github/workflows/*'
- '!.github/workflows/ios.yml'
- 'doc/**'
jobs:
prepare:
name: Prepare App Version
runs-on: macos-13
permissions:
contents: write
pull-requests: write
issues: write
repository-projects: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Prepare Version Folder
run: mkdir vers
- name: Checkout Version Files
uses: actions/checkout@v3
with:
ref: release-vers
persist-credentials: false
fetch-depth: 0
path: vers
- name: Change Project Version
run: |
read MVER < vers/ver.txt
MVER=$[MVER+1]
rm vers/ver.txt
echo $MVER >> vers/ver.txt
agvtool new-version -all $MVER
- name: Commit Files
working-directory: vers
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "Updated versions"
- name: Push Changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: release-vers
directory: vers
- name: Upload Proj
uses: actions/upload-artifact@v3
with:
name: Versioned Project
path: ./
build:
name: Build and Archive App
runs-on: macos-13
needs:
- prepare
steps:
- name: Download Versioned Project
uses: actions/download-artifact@v3
with:
name: Versioned Project
path: ./
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Install the Apple certificate and provisioning profile for Xcode
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Set Environment Varibles
run: |
CI=TRUE
CI_ARCHIVE_PATH=/Volumes/workspace/build.xcarchive
CI_BUNDLE_ID=com.darock.DarockBili
CI_PRODUCT=DarockBili
CI_PRODUCT_PLATFORM=iOS
CI_XCODEBUILD_ACTION=archive
CI_XCODE_PROJECT=DarockBili.xcodeproj
CI_XCODE_SCHEME=DarockBili
TMPDIR=$RUNNER_TEMP
- name: Restore Caches
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-main-archive-cache-
path: ~/Library/Developer/Xcode/DerivedData
- name: Resolve Package Dependencies
run: xcodebuild -resolvePackageDependencies -project ./DarockBili.xcodeproj -scheme 'DarockBili Watch App'
- name: Get Current Time
id: current-time
run: echo "time=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_OUTPUT
- name: Save Caches
uses: actions/cache/save@v3
with:
key: ${{ runner.os }}-main-archive-cache-${{ steps.current-time.outputs.time }}
path: ~/Library/Developer/Xcode/DerivedData
- name: Archive DarockBili App
env:
ASCAPI_KEY_ID: ${{ secrets.ASCAPI_KEY_ID }}
ASCAPI_ISSUER_ID: ${{ secrets.ASCAPI_ISSUER_ID }}
run: |
xcodebuild archive -project ./DarockBili.xcodeproj -scheme 'DarockBili Watch App' -archivePath ./build.xcarchive -IDEPostProgressNotifications=YES CODE_SIGN_IDENTITY=- AD_HOC_CODE_SIGNING_ALLOWED=YES CODE_SIGN_STYLE=Automatic DEVELOPMENT_TEAM=B57D8PP775 COMPILER_INDEX_STORE_ENABLE=NO
- name: Upload Xcode Archive
uses: actions/upload-artifact@v3
with:
name: Xcode Archive
path: ./build.xcarchive
build_comp:
name: Build Company App
runs-on: macos-13
needs:
- prepare
steps:
- name: Download Versioned Project
uses: actions/download-artifact@v3
with:
name: Versioned Project
path: ./
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Install Apple certificate and provisioning profile for Xcode
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.COMPANY_P12 }}
P12_PASSWORD: ${{ secrets.COMPANY_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.COMPANY_PROV }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Replace Bundle ID
run: |
sed -i "" 's/com.darock.DarockBili.watchkitapp/com.djbx.life.agent.dat/g' DarockBili.xcodeproj/project.pbxproj
sed -i "" 's/com.darock.DarockBili/com.djbx.life.agent.dat/g' DarockBili.xcodeproj/project.pbxproj
- name: Restore Caches
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-main-archive-cache-
path: ~/Library/Developer/Xcode/DerivedData
- name: Resolve Package Dependencies
run: xcodebuild -resolvePackageDependencies -project ./DarockBili.xcodeproj -scheme 'DarockBili Watch App'
- name: Get Current Time
id: current-time
run: echo "time=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_OUTPUT
- name: Save Caches
uses: actions/cache/save@v3
with:
key: ${{ runner.os }}-main-archive-cache-${{ steps.current-time.outputs.time }}
path: ~/Library/Developer/Xcode/DerivedData
- name: Archive DarockBili App
env:
COMPANY_PROV_UUID: ${{ secrets.COMPANY_PROV_UUID }}
COMPANY_P12_NAME: ${{ secrets.COMPANY_P12_NAME }}
run: |
xcodebuild archive -project ./DarockBili.xcodeproj -scheme 'DarockBili Watch App' -archivePath ./build.xcarchive -IDEPostProgressNotifications=YES CODE_SIGN_IDENTITY=- AD_HOC_CODE_SIGNING_ALLOWED=YES CODE_SIGN_STYLE=Automatic DEVELOPMENT_TEAM=H5SM6ZV38F COMPILER_INDEX_STORE_ENABLE=NO
- name: Upload Xcode Archive
uses: actions/upload-artifact@v3
with:
name: Company Xcode Archive
path: ./build.xcarchive
export:
name: Export App Store IPA
runs-on: macos-13
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Download App XCArchive
uses: actions/download-artifact@v3
with:
name: Xcode Archive
path: ./DarockBili_Release.xcarchive
- name: Install the Apple certificate and provisioning profile for Xcode
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Set Environment Varibles
run: |
CI=TRUE
CI_ARCHIVE_PATH=/Volumes/workspace/build.xcarchive
CI_BUNDLE_ID=com.darock.DarockBili
CI_PRODUCT=DarockBili
CI_PRODUCT_PLATFORM=iOS
CI_XCODEBUILD_ACTION=archive
CI_XCODE_PROJECT=DarockBili.xcodeproj
CI_XCODE_SCHEME=DarockBili
TMPDIR=$RUNNER_TEMP
- name: Export IPA File
run: |
xcodebuild -exportArchive -archivePath ./DarockBili_Release.xcarchive -exportPath ./ -exportOptionsPlist ./ExportOptions/app-store.plist -DVTProvisioningIsManaged=YES -DVTSkipCertificateValidityCheck=YES
mv DarockBili.ipa DarockBili_Release.ipa
- name: Upload IPA File
uses: actions/upload-artifact@v3
with:
name: Release IPA
path: ./DarockBili_Release.ipa
export_unsigned:
name: Export Unsigned IPA
runs-on: macos-13
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download App XCArchive
uses: actions/download-artifact@v3
with:
name: Xcode Archive
path: ./DarockBili_Release.xcarchive
- name: Export IPA File
run: |
mkdir Payload
cp -r DarockBili_Release.xcarchive/Products/Applications/DarockBili.app Payload
zip -q -r DarockBili_Unsigned.ipa Payload
- name: Upload IPA File
uses: actions/upload-artifact@v3
with:
name: Unsigned IPA
path: ./DarockBili_Unsigned.ipa
export_comp:
name: Export Company IPA
runs-on: macos-13
needs:
- build_comp
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Download App XCArchive
uses: actions/download-artifact@v3
with:
name: Company Xcode Archive
path: ./DarockBili_Release.xcarchive
- name: Install Company Cer and Prov
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.COMPANY_P12 }}
P12_PASSWORD: ${{ secrets.COMPANY_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.COMPANY_PROV }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Export IPA File
run: |
xcodebuild -exportArchive -archivePath ./DarockBili_Release.xcarchive -exportPath ./ -exportOptionsPlist ./ExportOptions/ad-hoc.plist -DVTProvisioningIsManaged=YES -DVTSkipCertificateValidityCheck=YES
mv '喵哩喵哩.ipa' DarockBili_Company.ipa
- name: Upload IPA File
uses: actions/upload-artifact@v3
with:
name: Company IPA
path: ./DarockBili_Company.ipa
deploy:
name: Deploy to TestFlight
runs-on: macos-13
needs:
- export
env:
ASCAPI_ISSUER_ID: ${{ secrets.ASCAPI_ISSUER_ID }}
ASCAPI_KEY_ID: ${{ secrets.ASCAPI_KEY_ID }}
ASCAPI_KEY: ${{ secrets.ASCAPI_KEY }}
steps:
- name: Download App Archive
uses: actions/download-artifact@v3
with:
name: Release IPA
- name: Prepare API Key
run: |
mkdir ~/.private_keys
echo "$ASCAPI_KEY" >> ~/.private_keys/AuthKey_${ASCAPI_KEY_ID}.p8
- name: Upload to App Store Connect
run: xcrun altool --upload-app -f ./DarockBili_Release.ipa -t ios --apiKey $ASCAPI_KEY_ID --apiIssuer $ASCAPI_ISSUER_ID