-
Notifications
You must be signed in to change notification settings - Fork 3
212 lines (173 loc) · 6.26 KB
/
build.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
name: Flutter Build
on: workflow_dispatch
permissions: write-all
jobs:
build_android:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
with:
repository: plum-tech/mimir-x
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
cache-dependency-path: tools/pnpm-lock.yaml
- name: Pnpm install
run: |
cd tools && pnpm i && cd ..
- name: Change version
run: |
node tools/increment-build-number.js
- name: Install JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
flutter-version-file: pubspec.yaml
- name: Build APK
run: |
flutter config --no-cli-animations
flutter build apk --target-platform android-arm,android-arm64
- name: Sign APK
uses: r0adkll/sign-android-release@v1
id: sign_apk
with:
releaseDirectory: build/app/outputs/flutter-apk
signingKeyBase64: ${{ secrets.APK_SIGN_JKS_BASE64 }}
keyStorePassword: ${{ secrets.APK_SIGN_JKS_PASSWORD }}
keyPassword: ${{ secrets.APK_SIGN_ALIAS_PASS }}
alias: ${{ secrets.APK_SIGN_ALIAS }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
- name: Publish Android Artifact
uses: actions/upload-artifact@v4
with:
name: Android-release
path: build/app/outputs/flutter-apk/*-signed.apk
build_ios:
runs-on: macos-14 # macos-latest is macos-12 actually, and iOS 17+ SDK not supported
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
with:
repository: plum-tech/mimir-x
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
cache-dependency-path: tools/pnpm-lock.yaml
- name: Pnpm install
run: |
cd tools && pnpm i && cd ..
- name: Change version
run: |
node tools/increment-build-number.js
- name: Change Develop to Distribution
run: |
node tools/to-distro.js
- name: Install Apple Certificate
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.P12_BASE64 }}
p12-password: ${{ secrets.P12_PASSWORD }}
- name: Install the provisioning profile
env:
PROVISIONING_CERTIFICATE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }}
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
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
flutter-version-file: pubspec.yaml
- name: Build iOS
run: |
flutter config --no-cli-animations
flutter build ios --release --no-codesign
- name: Build resolve Swift dependencies
run: |
xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release
- name: Build xArchive
run: |
xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release DEVELOPMENT_TEAM="TGBYYVM7AB" -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive PROVISIONING_PROFILE="535be9d5-550e-4871-bc9b-c2bdf9728641" clean archive CODE_SIGN_IDENTITY="Apple Distribution: Shanghai Plum Technology Ltd. (TGBYYVM7AB)"
- name: Export ipa
run: |
xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/ExportOptions.plist
- name: Publish iOS Artifact
uses: actions/upload-artifact@v4
with:
name: iOS-release
path: build-output/ios/life.mysit.SITLife.ipa
after_build:
runs-on: macos-latest
needs: [ build_android, build_ios ]
steps:
- uses: actions/checkout@v4
with:
repository: plum-tech/mimir-x
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
cache-dependency-path: tools/pnpm-lock.yaml
- name: Pnpm install
run: |
cd tools && pnpm i && cd ..
- name: Change version and push tag
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
node tools/increment-build-number.js --push
- name: Get iOS Artifact
uses: actions/download-artifact@v4
with:
name: iOS-release
path: build/
- name: Deploy to App Store (TestFlight)
uses: apple-actions/upload-testflight-build@v1
with:
app-path: ${{ github.workspace }}/build/life.mysit.SITLife.ipa
issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
api-key-id: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
api-private-key: ${{ secrets.APP_STORE_CONNECT_API_PRIVATE_KEY }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
- name: Get Android Artifact
uses: actions/download-artifact@v4
with:
name: Android-release
path: build/
- name: Publish preview version
continue-on-error: true
env:
MIMIR_VERSION_TOKEN: ${{ secrets.MIMIR_VERSION_ADMIN_TOKEN }}
run: |
node tools/publish-preview.js --upload build/app-release-signed.apk