-
Notifications
You must be signed in to change notification settings - Fork 12
182 lines (153 loc) · 5.92 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
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
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: Prepare Environment
run: gem install fastlane
- name: Build and Archive
uses: sparkfabrik/[email protected]
with:
upload-to-testflight: false
configuration: Release
export-method: appstore
scheme: DarockBili Watch App
output-path: MeowBili-Release.ipa
apple-key-id: ${{ secrets.ASCAPI_KEY_ID }}
apple-key-issuer-id: ${{ secrets.ASCAPI_ISSUER_ID }}
apple-key-content: ${{ secrets.ASCAPI_KEY }}
team-id: B57D8PP775
team-name: Yuxuan Chen
ios-app-id: com.darock.DarockBili
#- name: Archive DarockBili App
# env:
# ASCAPI_KEY_ID: ${{ secrets.ASCAPI_KEY_ID }}
# ASCAPI_ISSUER_ID: ${{ secrets.ASCAPI_ISSUER_ID }}
# run: |
# KEY_PATH=$RUNNER_TEMP/ascapi-key.p8
# xcodebuild -scheme 'DarockBili Watch App' -configuration Release DEVELOPMENT_TEAM=B57D8PP775 -archivePath DarockBili_Release.xcarchive clean archive CODE_SIGN_IDENTITY="Apple Development" -allowProvisioningUpdates -authenticationKeyPath $KEY_PATH -authenticationKeyID $ASCAPI_KEY_ID -authenticationKeyIssuerID $ASCAPI_ISSUER_ID
- 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_${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