-
Notifications
You must be signed in to change notification settings - Fork 7
423 lines (347 loc) · 12.6 KB
/
main.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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
name: Release
on:
push:
tags:
- '*'
jobs:
Windows:
runs-on: windows-2022
environment: Windows
steps:
- name: Clone
uses: actions/checkout@v3
- name: Create .env
run: Copy-Item ".\.env.example" -Destination ".\.env"
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
architecture: x64
flutter-version: '3.16.3'
channel: 'stable'
cache: true
- name: Setup Microsoft Store Developer CLI
uses: microsoft/setup-msstore-cli@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Configure Microsoft Store Developer CLI
run: |
(Get-Content pubspec.yaml).replace('<REAL_CN>', "${{ secrets.CN }}") | Set-Content pubspec.yaml
msstore reconfigure -t ${{ secrets.PARTNER_CENTER_TENANT_ID }} -s ${{ secrets.PARTNER_CENTER_SELLER_ID }} -c ${{ secrets.PARTNER_CENTER_CLIENT_ID }} -cs ${{ secrets.PARTNER_CENTER_CLIENT_SECRET }}
- name: Install Project Dependencies
run: flutter pub get
- name: Flutter Doctor
run: flutter doctor
- name: Set Version
run: (Get-Content pubspec.yaml).replace('0.0.0+0', "${{ github.ref_name }}+0") | Set-Content pubspec.yaml
- name: Binary
run: flutter build windows
- name: Archive build
run: |
Copy-Item '.\build\windows\x64\runner\Release' '.\myWitWallet' -Recurse
Compress-Archive -Path '.\myWitWallet' -DestinationPath '.\myWitWallet-windows.zip' -Force
- name: Compile MSIX
run: msstore package
- name: Release on Microsoft Store
run: msstore publish -i .\build\windows\x64\runner\Release -v
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: windows
path: .\myWitWallet-windows.zip
Linux:
runs-on: ubuntu-22.04
steps:
- name: Clone
uses: actions/checkout@v3
- name: Create .env
run: cp ./.env.example ./.env
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
architecture: x64
flutter-version: '3.16.3'
channel: 'stable'
cache: true
- name: Install Project Dependencies
run: flutter pub get
- name: Install Linux Dependencies
run: sudo apt-get update -y && sudo apt-get install -y ninja-build libgtk-3-dev
- name: Flutter Doctor
run: flutter doctor
- name: Set Version
run: sed -i "s/0.0.0+0/${{github.ref_name}}+0/g" pubspec.yaml
- name: Binary
run: flutter build linux --release
- name: LDD
run: ldd build/linux/x64/release/bundle/myWitWallet
- name: Archive Build
run: |
mv ./build/linux/x64/release/bundle ./myWitWallet
tar czvf myWitWallet-linux.tar.gz ./myWitWallet
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: linux
path: ./myWitWallet-linux.tar.gz
MacOs:
environment: Macos
runs-on: macos-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Create .env
run: cp ./.env.example ./.env
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
architecture: x64
flutter-version: '3.16.3'
channel: 'stable'
cache: true
- name: Install Project Dependencies
run: flutter pub get
- name: Flutter Doctor
run: flutter doctor
- name: Set Version
run: |
brew install gsed
gsed -i "s/0.0.0+0/${{github.ref_name}}+0/g" pubspec.yaml
- name: Binary
run: flutter build macos --release
- name: Prepare Signature/cert
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
KEY_CHAIN_PWD: ${{ secrets.KEY_CHAIN_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p $KEY_CHAIN_PWD build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p $KEY_CHAIN_PWD build.keychain
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEY_CHAIN_PWD build.keychain
security find-identity
- name: Sign
env:
IDENTITY_ID: ${{ secrets.IDENTITY_ID }}
run: |
codesign --options=runtime --force --deep -s $IDENTITY_ID ./build/macos/Build/Products/Release/myWitWallet.app -v
- name: Verify Sign
env:
IDENTITY_ID: ${{ secrets.IDENTITY_ID }}
run: codesign --verify -vvvv ./build/macos/Build/Products/Release/myWitWallet.app
- name: Create .dmg
run: |
brew install create-dmg
create-dmg \
--volname "myWitWallet" \
--window-pos 200 120 \
--window-size 800 529 \
--icon-size 130 \
--text-size 14 \
--icon "myWitWallet.app" 260 250 \
--hide-extension "myWitWallet.app" \
--app-drop-link 540 250 \
--hdiutil-verbose \
--no-internet-enable \
"myWitWallet.dmg" \
"./build/macos/Build/Products/Release/myWitWallet.app"
- name: Sign .dmg
env:
IDENTITY_ID: ${{ secrets.IDENTITY_ID }}
run: codesign --options=runtime --force --deep -s $IDENTITY_ID ./myWitWallet.dmg -v
- name: Notarize
env:
APPLE_EMAIL: ${{ secrets.APPLE_EMAIL }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
IDENTITY_ID: ${{ secrets.IDENTITY_ID }}
run: |
xcrun notarytool submit ./myWitWallet.dmg --apple-id "$APPLE_EMAIL" --password "$APPLE_PASSWORD" --team-id "$IDENTITY_ID" --wait
- name: Staple
run: xcrun stapler staple ./myWitWallet.dmg
- name: Verify Notarization & Stapling
run: |
spctl --assess -vvv --type install ./myWitWallet.dmg
xcrun stapler validate ./myWitWallet.dmg
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: macos
path: ./myWitWallet.dmg
Android:
runs-on: ubuntu-22.04
environment: Android
steps:
- name: Clone
uses: actions/checkout@v3
- name: Create .env
run: cp ./.env.example ./.env
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
architecture: x64
flutter-version: '3.16.3'
channel: 'stable'
cache: true
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
cache: 'gradle'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.2'
bundler-cache: true
working-directory: 'android'
- name: Install Project Dependencies
run: flutter pub get
- name: Flutter Doctor
run: flutter doctor
- name: Add Credentials / Keys
working-directory: android
env:
PGP: ${{ secrets.ANDROID_PGP_KEY }}
PHRASE: ${{ secrets.ANDROID_PGP_KEY_PASSPHRASE }}
GPSA: ${{ secrets.ANDROID_GOOGLE_PLAY_KEY }}
KPROP: ${{ secrets.ANDROID_KEY_PROPERTIES }}
run: |
echo "$PGP" > upload-keystore.jks.asc
gpg -d --passphrase "$PHRASE" --batch upload-keystore.jks.asc > upload-keystore.jks
echo "$GPSA" > gpsa.json
echo "$KPROP" > key.properties
- name: Add Beta Badge for Dev Releases
run: |
if [[ "${{github.ref_name}}" == *"dev"* ]]; then (cd android && ./beta_badge.sh); fi;
- name: Set Version
working-directory: android
run: |
bundle exec fastlane vcode
export VCODE=$(bundle exec fastlane vcode | grep -o 'VersionCode: [0-9]*$' | grep -o '[0-9]*$')
sed -i "s/0.0.0+0/${{github.ref_name}}+$VCODE/g" ../pubspec.yaml
- name: Binary (appbundle)
run: flutter build appbundle --release
- name: Binary (apk)
run: flutter build apk --release
- name: Run Tests
uses: maierj/[email protected]
with:
lane: 'test'
subdirectory: 'android'
- name: Release on Playstore
working-directory: android
run: if [[ "${{github.ref_name}}" == *"dev"* ]]; then bundle exec fastlane beta; else bundle exec fastlane production; fi;
- name: Archive Build
run: mv ./build/app/outputs/flutter-apk/app-release.apk ./myWitWallet.apk
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: android
path: ./myWitWallet.apk
IOS:
runs-on: macos-latest
environment: IOS
steps:
- name: Clone
uses: actions/checkout@v3
- name: Create .env
run: cp ./.env.example ./.env
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
architecture: x64
flutter-version: '3.16.3'
channel: 'stable'
cache: true
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.2'
bundler-cache: true
working-directory: 'ios'
- name: Flutter Doctor
run: |
flutter --disable-analytics
flutter doctor
- name: Install Project Dependencies
run: flutter pub get
- name: Install Cocoapods
working-directory: ios
run: pod install
- name: Setup SSH Keys and known_hosts for Fastlane Match
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh && touch ~/.ssh/known_hosts
echo "$PRIVATE_KEY" > ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts ~/.ssh/id_rsa
eval $(ssh-agent) && ssh-add ~/.ssh/id_rsa
- name: Add Credentials / Keys
working-directory: ios
env:
TEAM_ID: ${{ secrets.TEAM_ID }}
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
PGP: ${{ secrets.APPLE_API_KEY }}
PHRASE: ${{ secrets.APPLE_API_KEY_PASSPHRASE }}
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FASTLANE_USER: ${{ secrets.FASTLANE_USERNAME }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_AASP}}
run: |
brew install gnu-sed
gsed -i "s/TEAM_ID/$TEAM_ID/g" ./export_options.plist
gsed -i "s/SENSITIVE_REPLACE_ME/$TEAM_ID/g" ./Runner.xcodeproj/project.pbxproj
echo "$PGP" > key.json.asc
gpg -d --passphrase "$PHRASE" --batch key.json.asc > key.json
bundle exec fastlane setup
- name: Set Version
working-directory: ios
run: |
bundle exec fastlane vcode
export VCODE=$(bundle exec fastlane vcode | grep -o 'VersionCode: [0-9]*$' | grep -o '[0-9]*$')
gsed -i "s/0.0.0+0/${{github.ref_name}}+$VCODE/g" ../pubspec.yaml
- name: Binary(ipa)
run: flutter build ipa --release --export-options-plist=./ios/export_options.plist
- name: Release on App-Store
working-directory: ios
run: if [[ "${{github.ref_name}}" == *"dev"* ]]; then bundle exec fastlane beta; else bundle exec fastlane production; fi;
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ios
path: ./build/ios/ipa/myWitWallet.ipa
Release:
needs: [Windows, Linux, MacOs, Android, IOS]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
# Download All Artifacts
- uses: actions/download-artifact@v3
with:
path: release/
- name: Insert Tag
run: |
TAG=${{github.ref_name}}
sed -i "s/LATEST_VERSION/$TAG/g" RELEASE.md
- name: Organize Releases
run: |
cd release
mv windows/* .
mv linux/* .
mv macos/* .
mv android/* .
mv ios/* .
rm -rf windows linux macos android ios
- name: Publish Github Release
uses: ncipollo/release-action@v1
with:
name: "myWitWallet ${{github.ref_name}}"
artifacts: "./release/*"
bodyFile: "RELEASE.md"
artifactErrorsFailBuild: true