-
Notifications
You must be signed in to change notification settings - Fork 12
123 lines (101 loc) · 4.04 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
name: Meowbili iDevice Workflow
on:
push:
branches: [ "main" ]
paths-ignore:
- '.github/workflows/*'
- '!.github/workflows/ios.yml'
jobs:
build:
name: Build and Archive App
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Archive DarockBili App
run: |
xcodebuild -scheme 'DarockBili Watch App' -configuration Debug -archivePath DarockBili_Debug.xcarchive clean archive CODE_SIGN_IDENTITY=""
xcodebuild -scheme 'DarockBili Watch App' -configuration Release -archivePath DarockBili_Release.xcarchive clean archive CODE_SIGN_IDENTITY=""
- name: Upload Debug Archive
uses: actions/upload-artifact@v3
with:
name: Debug XCArchive
path: ./DarockBili_Debug.xcarchive
- name: Upload Release Archive
uses: actions/upload-artifact@v3
with:
name: Release XCArchive
path: ./DarockBili_Release.xcarchive
test:
runs-on: macos-13
name: Test App
steps:
- uses: actions/checkout@v3
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Resolve Swift dependencies
run: xcodebuild -resolvePackageDependencies -scheme 'DarockBili Watch App' -configuration Release
- name: Prepare Cache Folder
run: mkdir Caches
- name: Build and Test
run: xcodebuild test -project ./DarockBili.xcodeproj -scheme 'DarockBili Watch App' -configuration Release -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (41mm),OS=10.0' -testPlan WatchAppUITestPlan -testProductsPath ./Caches/TestProducts.xctestproducts -derivedDataPath ./Caches/DerivedData | tee TestBuilding.log
- name: Upload Building Log
uses: actions/upload-artifact@v3
with:
name: Watch Testing Log
path: ./TestBuilding.log
- name: Rename Test Attachments
run: for file in ./Caches/DerivedData/Logs/Test/Test-*.xcresult/Data/*; do if [ ! -f "$file" ]; then continue; fi; file_type=$(file -b --mime-type "$file"); extension=""; case "$file_type" in "image/jpeg" | "image/jpg") extension=".jpg";; "image/png") extension=".png";; "text/plain") extension=".txt";; *) extension=".dat";; esac; mv "$file" "$file$extension"; done
- name: Upload Test Attachments
uses: actions/upload-artifact@v3
with:
name: Test Attachments
path: ./Caches/DerivedData/Logs/Test
export:
name: Export 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: Release XCArchive
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_Release.ipa Payload
- name: Upload IPA File
uses: actions/upload-artifact@v3
with:
name: Release IPA
path: ./DarockBili_Release.ipa
deploy:
name: Deploy to TestFlight
runs-on: macos-13
needs:
- export
- test
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_1.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