-
Notifications
You must be signed in to change notification settings - Fork 0
362 lines (286 loc) · 9.82 KB
/
build.yml
File metadata and controls
362 lines (286 loc) · 9.82 KB
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
name: Build and Release
on:
push:
branches:
- main
tags:
- 'v*'
release:
types: [published]
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.38.7'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Generate licenses file
run: dart run dart_pubspec_licenses:generate
- name: Build Windows
run: flutter build windows --release
- name: Create Windows archive
run: |
Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath touchfish-windows-x64.zip
- name: Install msix pub tool
run: flutter pub global activate msix
- name: Build Windows MSIX installer
run: flutter pub global run msix:create
- name: Compile Inno Setup Installer
uses: Minionguyjpro/Inno-Setup-Action@v1.2.2
with:
path: setup.iss
- name: Upload Windows MSIX artifact
uses: actions/upload-artifact@v4
with:
name: windows-msix
path: build/windows/x64/runner/Release/*.msix
- name: Upload Windows ZIP artifact
uses: actions/upload-artifact@v4
with:
name: windows-build
path: touchfish-windows-x64.zip
- name: Upload Windows Setup artifact
uses: actions/upload-artifact@v4
with:
name: windows-setup
path: Installer/windows-x86_64-setup.exe
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.38.7'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Generate licenses file
run: dart run dart_pubspec_licenses:generate
- name: Install dmg package
run: flutter pub add --dev dmg
- name: Install dmgbuild
run: pip3 install dmgbuild --break-system-packages
- name: Build macOS
run: flutter build macos --release
- name: Create macOS DMG
run: dart run dmg --no-sign --no-notarization --license-path "./LICENSE"
- name: Create macOS archive
run: |
cd build/macos/Build/Products/Release
zip -r ../../../../../touchfish-macos.zip touchfish_client.app
- name: Upload macOS DMG artifact
uses: actions/upload-artifact@v4
with:
name: macos-dmg
path: build/macos/Build/Products/Release/*.dmg
- name: Upload macOS artifact
uses: actions/upload-artifact@v4
with:
name: macos-build
path: touchfish-macos.zip
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.38.7'
channel: 'stable'
- name: Install Linux dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev libasound2-dev libmpv-dev
- name: Install dependencies
run: flutter pub get
- name: Build Linux
run: flutter build linux --release
- name: Create Linux archive
run: |
cd build/linux/x64/release/bundle
zip -r ../../../../../touchfish-linux-x64.zip .
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: linux-build
path: touchfish-linux-x64.zip
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.38.7'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Generate licenses file
run: dart run dart_pubspec_licenses:generate
- name: Build Android APK
run: flutter build apk --release
- name: Build Android App Bundle
run: flutter build appbundle --release
- name: Rename builds
run: |
mv build/app/outputs/flutter-apk/app-release.apk touchfish-android.apk
mv build/app/outputs/bundle/release/app-release.aab touchfish-android.aab
- name: Upload Android APK artifact
uses: actions/upload-artifact@v4
with:
name: android-apk
path: touchfish-android.apk
- name: Upload Android AAB artifact
uses: actions/upload-artifact@v4
with:
name: android-aab
path: touchfish-android.aab
build-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.38.7'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Generate licenses file
run: dart run dart_pubspec_licenses:generate
- name: Build iOS (debug, no codesign)
run: flutter build ios --debug --no-codesign
- name: Create IPA
run: |
cd build/ios/iphoneos
mkdir -p Payload
cp -r Runner.app Payload/
zip -r ../../../touchfish-ios.ipa Payload
- name: Upload iOS IPA artifact
uses: actions/upload-artifact@v4
with:
name: ios-ipa
path: touchfish-ios.ipa
build-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.38.7'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Generate licenses file
run: dart run dart_pubspec_licenses:generate
- name: Build Web
run: flutter build web --release --no-web-resources-cdn
- name: Create Web archive
run: |
cd build/web
zip -r ../../touchfish-web.zip .
- name: Upload Web artifact
uses: actions/upload-artifact@v4
with:
name: web-build
path: touchfish-web.zip
release:
needs: [build-windows, build-macos, build-linux, build-android, build-ios, build-web]
runs-on: ubuntu-latest
if: always()
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir -p release-files
find artifacts -type f -exec cp {} release-files/ \;
ls -lh release-files/
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
- name: Create GitHub Release (Tag)
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: release-files/*
body: |
**Build Time / 编译时间:** ${{ steps.date.outputs.date }}
**Commit:** ${{ github.sha }}
### Installation / 安装
Please refer to the README for installation instructions.
请参考 README 获取安装说明。
draft: false
prerelease: false
- name: Create or update dev-build tag
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
id: create-or-update-ref
uses: ovsds/create-or-update-ref-action@v1
with:
ref: tags/dev-build
sha: ${{ github.sha }}
- name: Delete old dev-build tag locally
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: git tag -d dev-build || true
continue-on-error: true
- name: Upload assets to dev-build release
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
files: release-files/*
body: |
> [!WARNING]
> This is an automated development build and may be unstable.
> 这是一个自动生成的开发构建版本,可能不稳定。
**Build Time / 编译时间:** ${{ steps.date.outputs.date }}
**Commit:** ${{ github.sha }}
prerelease: true
tag_name: dev-build
name: Development Build
deploy-pages:
needs: build-web
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Download Web artifact
uses: actions/download-artifact@v4
with:
name: web-build
path: web-artifact
- name: Extract Web build
run: |
unzip web-artifact/touchfish-web.zip -d ./web-build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './web-build'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4