forked from localsend/localsend
-
Notifications
You must be signed in to change notification settings - Fork 0
541 lines (441 loc) · 16.6 KB
/
release.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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
name: Release Draft
on:
workflow_dispatch:
env:
FLUTTER_VERSION: "3.24.5"
RUST_VERSION: "1.83.0"
APK_BUILD_DIR: "/tmp/build"
jobs:
build:
runs-on: ubuntu-20.04
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Get version from pubspec.yaml
id: get_version
run: |
VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' app/pubspec.yaml)
echo "version=$VERSION" >> $GITHUB_OUTPUT
build_apk:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Remove proprietary dependencies
run: sh scripts/remove_proprietary_dependencies.sh
- name: Copy files to env.APK_BUILD_DIR
run: |
mkdir -p $APK_BUILD_DIR
cp -r . $APK_BUILD_DIR
- name: Decode key.properties file
working-directory: ${{ env.APK_BUILD_DIR }}
env:
ENCODED_STRING: ${{ secrets.ANDROID_KEY_PROPERTIES }}
run: echo $ENCODED_STRING | base64 -di > app/android/key.properties
- name: Decode android-keystore.jks file
working-directory: ${{ env.APK_BUILD_DIR }}
env:
ENCODED_STRING: ${{ secrets.ANDROID_KEY_STORE }}
run: mkdir secrets && echo $ENCODED_STRING | base64 -di > secrets/android-keystore.jks
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: ${{ env.RUST_VERSION }}
- name: Dependencies
working-directory: ${{ env.APK_BUILD_DIR }}/app
run: flutter pub get
- name: Build APK
working-directory: ${{ env.APK_BUILD_DIR }}/app
run: flutter build apk --split-per-abi
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: apk-result
path: |
${{ env.APK_BUILD_DIR }}/app/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
${{ env.APK_BUILD_DIR }}/app/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
${{ env.APK_BUILD_DIR }}/app/build/app/outputs/flutter-apk/app-x86_64-release.apk
build_tar_x86_64:
needs: build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
- name: Dependencies
working-directory: app
run: flutter pub get
- name: Compile linux
working-directory: app
run: flutter build linux
- name: Create tar.gz archive
run: |
cd app/build/linux/x64/release/bundle
tar -czvf ../../../../../result.tar.gz *
- name: Upload tar.gz archive
uses: actions/upload-artifact@v4
with:
name: tar-gz-x86-64-result
path: ./app/*.tar.gz
# Manage the Flutter version on the self-hosted runner manually!
# Flutter currently doesn't provide Linux ARM64 binaries.
build_tar_arm_64:
needs: build
runs-on: [ self-hosted, linux, arm64 ]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev
- name: Dependencies
working-directory: app
run: flutter pub get
- name: Compile linux
working-directory: app
run: flutter build linux
- name: Create tar.gz archive
run: |
cd app/build/linux/arm64/release/bundle
tar -czvf ../../../../../result.tar.gz *
- name: Upload tar.gz archive
uses: actions/upload-artifact@v4
with:
name: tar-gz-arm-64-result
path: ./app/*.tar.gz
build_deb_x86_64:
needs: build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
- name: Enable dart_distributor
run: dart pub global activate flutter_distributor
- name: Update PATH
run: echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> ~/.bashrc
- name: Build deb package
working-directory: app
run: flutter_distributor package --platform linux --targets deb
- name: Find deb file
id: find_deb
run: |
VERSION=${{ needs.build.outputs.version }}
DEB_PATH=$(find app/dist -name "localsend_app-$VERSION*-linux.deb")
echo "deb_path=$DEB_PATH" >> $GITHUB_OUTPUT
- name: Check if deb file exists
id: check_file
run: |
if [[ ! -f "${{ steps.find_deb.outputs.deb_path }}" ]]; then
echo "File not found: ${{ steps.find_deb.outputs.deb_path }}"
exit 1
fi
- name: Upload deb file
uses: actions/upload-artifact@v4
with:
name: deb-x86-64-result
path: ${{ steps.find_deb.outputs.deb_path }}
# Manage the Flutter version on the self-hosted runner manually!
# Flutter currently doesn't provide Linux ARM64 binaries.
build_deb_arm_64:
needs: build
runs-on: [ self-hosted, linux, arm64 ]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev
- name: Enable dart_distributor
run: dart pub global activate flutter_distributor
- name: Build deb package
working-directory: app
run: PATH="$PATH:$HOME/.pub-cache/bin" flutter_distributor package --platform linux --targets deb
- name: Find deb file
id: find_deb
run: |
VERSION=${{ needs.build.outputs.version }}
DEB_PATH=$(find app/dist -name "localsend_app-$VERSION*-linux.deb")
echo "deb_path=$DEB_PATH" >> $GITHUB_OUTPUT
- name: Check if deb file exists
id: check_file
run: |
if [[ ! -f "${{ steps.find_deb.outputs.deb_path }}" ]]; then
echo "File not found: ${{ steps.find_deb.outputs.deb_path }}"
exit 1
fi
- name: Upload deb file
uses: actions/upload-artifact@v4
with:
name: deb-arm-64-result
path: ${{ steps.find_deb.outputs.deb_path }}
build_appimage_x86_64:
needs: build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev libfuse2
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
- name: Dependencies
working-directory: app
run: flutter pub get
- name: Compile linux
working-directory: app
run: flutter build linux
- name: Copy compiled linux files
run: |
mkdir AppDir
cp -r app/build/linux/x64/release/bundle/* AppDir/
- name: Copy logo to AppDir
run: |
mkdir -p AppDir/usr/share/icons/hicolor/32x32/apps
cp app/assets/img/logo-32.png AppDir/usr/share/icons/hicolor/32x32/apps/localsend.png
mkdir -p AppDir/usr/share/icons/hicolor/128x128/apps
cp app/assets/img/logo-128.png AppDir/usr/share/icons/hicolor/128x128/apps/localsend.png
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
cp app/assets/img/logo-256.png AppDir/usr/share/icons/hicolor/256x256/apps/localsend.png
- name: Copy Recipe to correct location
run: cp scripts/appimage/AppImageBuilder_x86_64.yml AppImageBuilder.yml
- name: Build AppImage
uses: AppImageCrafters/build-appimage@57c3bc6963f870ce3be103117de5b5e33ffbaeb6
with:
recipe: ./AppImageBuilder.yml
- name: Upload AppImage file
uses: actions/upload-artifact@v4
with:
name: appimage-x86-64-result
path: ./*.AppImage
build_windows_zip_x86_64:
needs: build
runs-on: windows-latest
steps:
- name: Fix long file paths
run: git config --system core.longpaths true
- name: Checkout repository
uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
- name: Dependencies
working-directory: app
run: flutter pub get
- name: Compile for Windows
working-directory: app
run: flutter build windows
- name: Create empty settings.json
working-directory: app
run: echo {} > build/windows/x64/runner/Release/settings.json
- name: Add DLL files
working-directory: app
run: |
Copy-Item ../scripts/windows/x64/msvcp140.dll build/windows/x64/runner/Release/
Copy-Item ../scripts/windows/x64/vcruntime140.dll build/windows/x64/runner/Release/
Copy-Item ../scripts/windows/x64/vcruntime140_1.dll build/windows/x64/runner/Release/
- name: Zip compiled files
working-directory: app
run: Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath LocalSend.zip
- name: Upload zip
uses: actions/upload-artifact@v4
with:
name: windows-zip-x86-64-result
path: app/LocalSend.zip
release:
needs:
- build
- build_apk
- build_tar_x86_64
- build_tar_arm_64
- build_deb_x86_64
- build_deb_arm_64
- build_appimage_x86_64
- build_windows_zip_x86_64
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Draft release
id: draft_release
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: v${{ needs.build.outputs.version }}
name: v${{ needs.build.outputs.version }}
# APK
- name: Download apk file
uses: actions/download-artifact@v4
with:
name: apk-result
path: apk-result
- name: Copy apk file to root
run: cp apk-result/*.apk .
- name: Upload Release Asset (arm32v7)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
asset_path: app-armeabi-v7a-release.apk
asset_name: LocalSend-${{ needs.build.outputs.version }}-android-arm32v7.apk
asset_content_type: application/vnd.android.package-archive
- name: Upload Release Asset (arm64v8)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
asset_path: app-arm64-v8a-release.apk
asset_name: LocalSend-${{ needs.build.outputs.version }}-android-arm64v8.apk
asset_content_type: application/vnd.android.package-archive
- name: Upload Release Asset (x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
asset_path: app-x86_64-release.apk
asset_name: LocalSend-${{ needs.build.outputs.version }}-android-x64.apk
asset_content_type: application/vnd.android.package-archive
# TAR.GZ (x86_64)
- name: Download tar.gz file
uses: actions/download-artifact@v4
with:
name: tar-gz-x86-64-result
path: tar-gz-x86-64-result
- name: List files in tar.gz-directory
run: ls -l tar-gz-x86-64-result
- name: Copy tar.gz file to root
run: cp tar-gz-x86-64-result/* result.tar.gz
- name: Upload Release Asset (tar.gz)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
asset_path: result.tar.gz
asset_name: LocalSend-${{ needs.build.outputs.version }}-linux-x86-64.tar.gz
asset_content_type: application/gzip
# TAR.GZ (arm_64)
- name: Download tar.gz file
uses: actions/download-artifact@v4
with:
name: tar-gz-arm-64-result
path: tar-gz-arm-64-result
- name: List files in tar.gz-directory
run: ls -l tar-gz-arm-64-result
- name: Copy tar.gz file to root
run: cp tar-gz-arm-64-result/* result.tar.gz
- name: Upload Release Asset (tar.gz)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
asset_path: result.tar.gz
asset_name: LocalSend-${{ needs.build.outputs.version }}-linux-arm-64.tar.gz
asset_content_type: application/gzip
# DEB (x86_64)
- name: Download deb file
uses: actions/download-artifact@v4
with:
name: deb-x86-64-result
path: deb-x86-64-result
- name: Copy deb file to root
run: cp deb-x86-64-result/*.deb result.deb
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
asset_path: result.deb
asset_name: LocalSend-${{ needs.build.outputs.version }}-linux-x86-64.deb
asset_content_type: application/vnd.debian.binary-package
# DEB (arm_64)
- name: Download deb file
uses: actions/download-artifact@v4
with:
name: deb-arm-64-result
path: deb-arm-64-result
- name: Copy deb file to root
run: cp deb-arm-64-result/*.deb result.deb
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
asset_path: result.deb
asset_name: LocalSend-${{ needs.build.outputs.version }}-linux-arm-64.deb
asset_content_type: application/vnd.debian.binary-package
# APPIMAGE (x86_64)
- name: Download AppImage file
uses: actions/download-artifact@v4
with:
name: appimage-x86-64-result
path: appimage-x86-64-result
- name: List files in appimage-directory
run: ls -l appimage-x86-64-result
- name: Copy AppImage file to root
run: |
for file in appimage-x86-64-result/*; do
if [[ $file == *.AppImage && $file != *.AppImage.zsync ]]; then
cp "$file" result.AppImage
fi
done
- name: Upload Release Asset (AppImage)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
asset_path: result.AppImage
asset_name: LocalSend-${{ needs.build.outputs.version }}-linux-x86-64.AppImage
asset_content_type: application/x-appimage
# WINDOWS ZIP (x86_64)
- name: Download windows zip file
uses: actions/download-artifact@v4
with:
name: windows-zip-x86-64-result
path: windows-zip-x86-64-result
- name: Copy zip file to root
run: cp windows-zip-x86-64-result/*.zip result.zip
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
asset_path: result.zip
asset_name: LocalSend-${{ needs.build.outputs.version }}-windows-x86-64.zip
asset_content_type: application/zip