|
4 | 4 | # Enable manual run |
5 | 5 | workflow_dispatch: |
6 | 6 | push: |
7 | | - tags: |
8 | | - - '**' |
9 | | - branches: |
10 | | - - '**' |
11 | | - paths: |
12 | | - - .github/workflows/linux.yml |
13 | | - - appimage/AppImageBuilder.yml |
14 | 7 |
|
15 | 8 | jobs: |
16 | | - build-flutter-app-x86_64: |
17 | | - name: Build Flutter app (x86_64) |
18 | | - runs-on: ubuntu-latest |
19 | | - permissions: |
20 | | - contents: write |
21 | | - timeout-minutes: 20 |
22 | | - steps: |
23 | | - - name: Checkout code |
24 | | - uses: actions/checkout@v4 |
25 | | - |
26 | | - - name: Install apt dependencies |
27 | | - uses: awalsh128/cache-apt-pkgs-action@latest |
28 | | - with: |
29 | | - packages: libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev libsecret-1-dev libjsoncpp-dev ghostscript libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev webkit2gtk-4.1-dev |
30 | | - version: 1.0 |
31 | | - execute_install_scripts: true |
32 | | - |
33 | | - - name: Setup cache |
34 | | - uses: actions/cache@v4 |
35 | | - with: |
36 | | - path: | |
37 | | - build |
38 | | - key: ${{ runner.OS }}-saber-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('**/*.dart') }} |
39 | | - restore-keys: | |
40 | | - ${{ runner.OS }}-saber- |
41 | | - |
42 | | - - name: Remove proprietary dependencies |
43 | | - run: ./patches/remove_proprietary_dependencies.sh |
44 | | - |
45 | | - - name: Setup Flutter |
46 | | - uses: subosito/flutter-action@v2 |
47 | | - with: |
48 | | - channel: stable |
49 | | - cache: true |
50 | | - cache-key: 'flutter-:os:-:channel:-:version:-:arch:' |
51 | | - |
52 | | - - name: Disable Flutter CLI animations |
53 | | - run: flutter config --no-cli-animations |
54 | | - |
55 | | - - run: flutter pub get |
56 | | - |
57 | | - - name: Build Linux (x86_64) |
58 | | - run: | |
59 | | - flutter build linux \ |
60 | | - --dart-define=DIRTY=$DIRTY |
61 | | - env: |
62 | | - DIRTY: ${{ !startsWith(github.ref, 'refs/tags/') }} |
63 | | - |
64 | | - - name: Compress Flutter build |
65 | | - id: compress |
66 | | - run: | |
67 | | - buildName=$(grep -oP "(?<=buildName = ').*(?=')" lib/data/version.dart) |
68 | | - archiveName="Saber_v${buildName}_Linux_x86_64.tar.gz" |
69 | | - echo "archiveName=$archiveName" >> $GITHUB_OUTPUT |
70 | | -
|
71 | | - mkdir -p AppDir |
72 | | - mv build/linux/x64/release/bundle/* AppDir |
73 | | - chmod +x AppDir/saber |
74 | | -
|
75 | | - install -Dm644 flatpak/com.adilhanney.saber.metainfo.xml -t AppDir/share/metainfo/ |
76 | | - install -Dm644 flatpak/com.adilhanney.saber.metainfo.xml -t AppDir/usr/share/metainfo/ |
77 | | -
|
78 | | - install -Dm644 assets/icon/icon.svg AppDir/share/icons/hicolor/scalable/apps/com.adilhanney.saber.svg |
79 | | - install -Dm644 assets/icon/icon.svg AppDir/usr/share/icons/hicolor/scalable/apps/com.adilhanney.saber.svg |
80 | | -
|
81 | | - install -Dm644 flatpak/com.adilhanney.saber.desktop -t AppDir/share/applications/ |
82 | | -
|
83 | | - tar -C AppDir -cvf $archiveName . |
84 | | -
|
85 | | - - name: Upload artifact |
86 | | - uses: actions/upload-artifact@v4 |
87 | | - with: |
88 | | - name: Saber-Archive-x86_64 |
89 | | - path: ${{ steps.compress.outputs.archiveName }} |
90 | | - |
91 | | - - name: Upload to GitHub release |
92 | | - uses: svenstaro/upload-release-action@v2 |
93 | | - if: ${{ startsWith(github.ref, 'refs/tags/') }} |
94 | | - with: |
95 | | - repo_token: ${{ secrets.GITHUB_TOKEN }} |
96 | | - file: ${{ steps.compress.outputs.archiveName }} |
97 | | - |
98 | 9 | build-flutter-app-arm64: |
99 | 10 | name: Build Flutter app (arm64) |
100 | 11 | runs-on: ubuntu-latest |
@@ -255,66 +166,3 @@ jobs: |
255 | 166 | with: |
256 | 167 | repo_token: ${{ secrets.GITHUB_TOKEN }} |
257 | 168 | file: ${{ steps.compress.outputs.archiveName }} |
258 | | - |
259 | | - build-appimage: |
260 | | - name: Build AppImage |
261 | | - needs: build-flutter-app-x86_64 |
262 | | - runs-on: ubuntu-latest |
263 | | - permissions: |
264 | | - contents: write |
265 | | - timeout-minutes: 10 |
266 | | - steps: |
267 | | - - name: Checkout code |
268 | | - uses: actions/checkout@v4 |
269 | | - |
270 | | - - name: Install AppImage dependencies |
271 | | - run: | |
272 | | - sudo add-apt-repository universe |
273 | | - sudo apt install libfuse2 |
274 | | -
|
275 | | - - name: Download app archive |
276 | | - uses: actions/download-artifact@v4 |
277 | | - with: |
278 | | - name: Saber-Archive-x86_64 |
279 | | - |
280 | | - - name: Rename app archive |
281 | | - run: | |
282 | | - mv Saber_*.tar.gz Saber-Linux-Portable.tar.gz |
283 | | -
|
284 | | - - name: Download appimage-builder |
285 | | - working-directory: appimage |
286 | | - run: | |
287 | | - wget -O appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage |
288 | | - chmod +x appimage-builder-x86_64.AppImage |
289 | | -
|
290 | | - - name: Prepare build files |
291 | | - working-directory: appimage |
292 | | - run: | |
293 | | - mkdir AppDir |
294 | | - tar -xvf ../Saber-Linux-Portable.tar.gz -C AppDir |
295 | | -
|
296 | | - - name: Set AppImage version |
297 | | - working-directory: appimage |
298 | | - run: | |
299 | | - # replace line with "version: latest" with "version: $buildName" |
300 | | - buildName=$(grep -oP "(?<=buildName = ').*(?=')" ../lib/data/version.dart) |
301 | | - sed -i "s/version: latest/version: ${buildName}/" AppImageBuilder.yml |
302 | | -
|
303 | | - - name: Build AppImage |
304 | | - working-directory: appimage |
305 | | - run: | |
306 | | - ./appimage-builder-x86_64.AppImage --skip-test |
307 | | -
|
308 | | - - name: Upload artifact |
309 | | - uses: actions/upload-artifact@v4 |
310 | | - with: |
311 | | - name: AppImage artifact |
312 | | - path: appimage/Saber-*-x86_64.AppImage* |
313 | | - |
314 | | - - name: Upload to GitHub release |
315 | | - uses: svenstaro/upload-release-action@v2 |
316 | | - if: ${{ startsWith(github.ref, 'refs/tags/') }} |
317 | | - with: |
318 | | - repo_token: ${{ secrets.GITHUB_TOKEN }} |
319 | | - file: appimage/Saber-*-x86_64.AppImage* |
320 | | - file_glob: true |
0 commit comments