-
Notifications
You must be signed in to change notification settings - Fork 105
307 lines (251 loc) · 11 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
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
name: "BUILD"
on:
workflow_dispatch:
jobs:
get_version:
runs-on: ubuntu-latest
outputs:
app_version: ${{ steps.fetch_version.outputs.app_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Fetch Version
id: fetch_version
run: |
sudo snap install yq
app_version=$(yq eval '.version' pubspec.yaml)
echo "::set-output name=app_version::$app_version"
build_on_macos:
needs: get_version
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Replace
env:
SOME_SECRET_KEY: ${{ secrets.SOME_SECRET_KEY }}
SOME_REPLACE_KEY: ${{ secrets.SOME_REPLACE_KEY }}
SOME_REPLACE_FILE: ${{ secrets.SOME_REPLACE_FILE }}
run: |
python tools/replace.py
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "beta"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 21
- name: Install Dependencies
run: |-
flutter pub get
npm install -g appdmg
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Flutter build ios
run: |-
flutter build ios --release --no-codesign --verbose
chmod 777 tools/unbitcode.sh
sh tools/unbitcode.sh
mkdir -p Payload
mv ./build/ios/iphoneos/Runner.app Payload
zip -r -y Payload.zip Payload/Runner.app
mv Payload.zip AppRhyme-release-ios-unknown-${{ needs.get_version.outputs.app_version }}.ipa
- name: Upload IPA
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-ios-unknown-${{ needs.get_version.outputs.app_version }}.ipa
path: AppRhyme-release-ios-unknown-${{ needs.get_version.outputs.app_version }}.ipa
compression-level: 9
- name: Pack DMG Installer
run: |-
dart pub global activate -s path tools/flutter_distributor/packages/flutter_distributor
flutter_distributor package --platform macos --target dmg
- name: Rename
run: |
mv ./dist/${{ needs.get_version.outputs.app_version }}/*.dmg ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-macos-unknown-${{ needs.get_version.outputs.app_version }}.dmg
- name: Upload Macos app
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-macos-unknown-${{ needs.get_version.outputs.app_version }}.zip
path: ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-macos-unknown-${{ needs.get_version.outputs.app_version }}.dmg
compression-level: 9
build_on_linux:
needs: get_version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Replace
env:
SOME_SECRET_KEY: ${{ secrets.SOME_SECRET_KEY }}
SOME_REPLACE_KEY: ${{ secrets.SOME_REPLACE_KEY }}
SOME_REPLACE_FILE: ${{ secrets.SOME_REPLACE_FILE }}
run: |
python tools\replace.py
- uses: subosito/flutter-action@v2
with:
channel: "beta"
- name: Install Flutter Dependency
run: flutter pub get
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Linux dependency
run: |
sudo apt-get update -y
sudo apt install libwebkit2gtk-4.1-dev
sudo apt-get install -y ninja-build libgtk-3-dev libfuse2
sudo apt-get install libasound2-dev
- name: Setup AppImageTool
run: |-
sudo mv tools/appimagetool-x86_64.AppImage /usr/local/bin/appimagetool
sudo chmod a+x /usr/local/bin/appimagetool
- name: Pack Installers
run: |-
dart pub global activate -s path tools/flutter_distributor/packages/flutter_distributor
flutter_distributor package --platform linux --targets appimage,deb,rpm
- name: Rename
run: |
mv ./dist/${{ needs.get_version.outputs.app_version }}/*.deb ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-linux-x86_64-${{ needs.get_version.outputs.app_version }}.deb
mv ./dist/${{ needs.get_version.outputs.app_version }}/*.rpm ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-linux-x86_64-${{ needs.get_version.outputs.app_version }}.rpm
mv ./dist/${{ needs.get_version.outputs.app_version }}/*.AppImage ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-linux-x86_64-${{ needs.get_version.outputs.app_version }}.AppImage
- name: Upload Linux app
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-linux-x86_64-AppImage-${{ needs.get_version.outputs.app_version }}.zip
path: ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-linux-x86_64-${{ needs.get_version.outputs.app_version }}.AppImage
compression-level: 9
- name: Upload Linux app
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-linux-x86_64-rpm-${{ needs.get_version.outputs.app_version }}.zip
path: ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-linux-x86_64-${{ needs.get_version.outputs.app_version }}.rpm
compression-level: 9
- name: Upload Linux app
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-linux-x86_64-deb-${{ needs.get_version.outputs.app_version }}.zip
path: ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-linux-x86_64-${{ needs.get_version.outputs.app_version }}.deb
compression-level: 9
build_on_windows:
needs: get_version
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Replace
env:
SOME_SECRET_KEY: ${{ secrets.SOME_SECRET_KEY }}
SOME_REPLACE_KEY: ${{ secrets.SOME_REPLACE_KEY }}
SOME_REPLACE_FILE: ${{ secrets.SOME_REPLACE_FILE }}
run: |
python tools\replace.py
- name: Set up signing files
run: |
$env:APK_SIGN_PWD="${{ secrets.APK_SIGN_PWD }}"
$env:APK_SIGN_ALIAS="${{ secrets.APK_SIGN_ALIAS }}"
$env:APK_SIGN_JKS="${{ secrets.APK_SIGN_JKS }}"
python tools/create_signing_files.py
shell: pwsh
- name: Print contents and length
run: |
Get-Content android\key.properties
$keyPropertiesLength = (Get-Content android\key.properties | Out-String).Length
echo "key.properties length: $keyPropertiesLength"
$keyJksLength = (Get-Item android\app\key.jks).length
echo "key.jks length: $keyJksLength"
shell: pwsh
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Install Flutter Dependency
run: flutter pub get
- name: Install Rusti
uses: dtolnay/rust-toolchain@stable
- name: Install Cargo-Ndk
run: cargo install cargo-ndk --version 2.11.0 --force
- name: Install android ndk
uses: nttld/setup-ndk@v1
id: install-ndk
with:
ndk-version: r22b
- name: Activate Dependencies
shell: pwsh
run: dart pub global activate flutter_distributor
- name: Setup Inno Setup 6
shell: pwsh
run: |-
./tools/is.exe /VERYSLIENT
Copy-Item "./tools/ChineseSimplified.isl" -Destination "C:\Program Files (x86)\Inno Setup 6\Languages"
- name: Pack EXE Installer
run: flutter_distributor package --platform windows --target exe
- name: Rename
run: |
mv ./dist/${{ needs.get_version.outputs.app_version }}/*.exe ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-windows-x86_64-${{ needs.get_version.outputs.app_version }}-setup.exe
- name: Upload files
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-windows-x86_64-${{ needs.get_version.outputs.app_version }}-setup.zip
path: ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-windows-x86_64-${{ needs.get_version.outputs.app_version }}-setup.exe
compression-level: 9
- name: Flutter build apk abi
run: flutter build apk --release --split-per-abi --verbose
- name: Flutter build apk
run: flutter build apk --release --verbose
- name: Upload APK1
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-android-arm64_v8a-${{needs.get_version.outputs.app_version}}.apk
path: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
compression-level: 9
- name: Upload APK2
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-android-armeabi_v7a-${{needs.get_version.outputs.app_version}}.zip
path: build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
compression-level: 9
- name: Upload APK3
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-android-x86_64-${{needs.get_version.outputs.app_version}}.zip
path: build/app/outputs/flutter-apk/app-x86_64-release.apk
compression-level: 9
- name: Upload APK4
uses: actions/upload-artifact@v4
with:
name: AppRhyme-release-android-unknown-${{needs.get_version.outputs.app_version}}.zip
path: build/app/outputs/flutter-apk/app-release.apk
compression-level: 9
- name: Rename APKs
run: |
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build/app/outputs/flutter-apk/AppRhyme-release-android-arm64_v8a-${{needs.get_version.outputs.app_version}}.apk
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build/app/outputs/flutter-apk/AppRhyme-release-android-armeabi_v7a-${{needs.get_version.outputs.app_version}}.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk build/app/outputs/flutter-apk/AppRhyme-release-android-x86_64-${{needs.get_version.outputs.app_version}}.apk
mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/AppRhyme-release-android-unknown-${{needs.get_version.outputs.app_version}}.apk