From d4893b5d2cb2e7ef271e4c2d66683e30d70352e2 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Wed, 26 Jun 2024 09:25:37 +0100 Subject: [PATCH] feat: add flutter_distributor This adds flutter_distributor to build AppImage, deb, rpm and zip for Linux x86 when a new release is tagged. - Close #97 - Close #90 --- .github/workflows/build-quickemu.yml | 4 +- .github/workflows/publish-quickemu.yml | 93 +++++++++++++++++++++++ .gitignore | 1 + distribute_options.yaml | 14 ++++ linux/packaging/appimage/make_config.yaml | 25 ++++++ linux/packaging/deb/make_config.yaml | 41 ++++++++++ linux/packaging/rpm/make_config.yaml | 32 ++++++++ pubspec.yaml | 5 +- 8 files changed, 211 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish-quickemu.yml create mode 100644 distribute_options.yaml create mode 100644 linux/packaging/appimage/make_config.yaml create mode 100644 linux/packaging/deb/make_config.yaml create mode 100644 linux/packaging/rpm/make_config.yaml diff --git a/.github/workflows/build-quickemu.yml b/.github/workflows/build-quickemu.yml index 797a160..20e3b28 100644 --- a/.github/workflows/build-quickemu.yml +++ b/.github/workflows/build-quickemu.yml @@ -30,11 +30,11 @@ jobs: run: flutter config --enable-linux-desktop - name: Build artifacts ๐Ÿ—๏ธ run: flutter build linux --release - - name: Build output ๐ŸŒณ + - name: Show artifacts ๐Ÿ‘€ run: tree build/linux/x64/release/bundle - name: Upload artifacts โคด๏ธ uses: actions/upload-artifact@v4 with: - name: Quickgui-${{github.run_number}}-linux.zip + name: Quickgui-${{github.run_number}}-linux-x64 path: build/linux/x64/release/bundle overwrite: true diff --git a/.github/workflows/publish-quickemu.yml b/.github/workflows/publish-quickemu.yml new file mode 100644 index 0000000..faf34a8 --- /dev/null +++ b/.github/workflows/publish-quickemu.yml @@ -0,0 +1,93 @@ +name: Publish Quickgui ๐Ÿท๏ธ + +on: + push: + tags: + - "v?[0-9]+.[0-9]+.[0-9]+*" + workflow_dispatch: + inputs: + tag: + description: "The existing tag to publish" + type: "string" + required: true + +# TODO: arm64 runner +# https://github.blog/changelog/2024-06-03-actions-arm-based-linux-and-windows-runners-are-now-in-public-beta/ + +jobs: + version-check: + # The git tag and pubspec.yaml version must be identical. + name: "Check versions โš–๏ธ" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: "Compare App and Git versions ๐ŸŸฐ" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + APP_VERSION=$(grep "^version" pubspec.yaml | cut -d' ' -f2) + GIT_VERSION=$(git describe --tags | cut -d'-' -f1) + echo "App version: ${REL_VERSION}" + echo "Git version: ${GIT_VERSION}" + if [ "${APP_VERSION}" != "${GIT_VERSION}" ]; then + echo "ERROR! Version mismatch."; + exit 1 + fi + + build-linux-x64: + needs: [version-check] + name: "Build Linux x64 ๐Ÿ—๏ธ" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + channel: stable + architecture: x64 + flutter-version-file: pubspec.yaml + - name: Install system dependencies ๐Ÿ“ฆ๏ธ + run: sudo apt-get install -y clang cmake libblkid1 liblzma5 libgtk-3-0 libgtk-3-dev ninja-build pkg-config + - name: Install Flutter dependencies ๐Ÿฆ‹ + run: flutter pub get + - name: Activate flutter_distributor ๐Ÿš€ + run: dart pub global activate flutter_distributor + - name: Build AppImage ๐Ÿง + run: | + sudo apt-get install -y libfuse-dev locate + wget -q "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool + chmod +x /usr/local/bin/appimagetool + flutter_distributor package --platform=linux --targets=appimage + - name: Build .deb ๐Ÿฅ + run: | + sudo apt-get install -y dpkg + flutter_distributor package --platform=linux --targets=deb + - name: Build .rpm ๐ŸŽฉ + run: | + sudo apt-get install -y patchelf rpm + flutter_distributor package --platform=linux --targets=rpm + - name: Build .zip ๐Ÿค + run: flutter_distributor package --platform=linux --targets=zip + - name: Show artifacts ๐Ÿ‘€ + run: tree dist/ + + publish-release: + needs: [build-linux-x64] + name: "Publish Release ๐Ÿ“ค๏ธ" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Publish release ${{ github.ref }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + REL_VER=$(grep "^version" pubspec.yaml | cut -d' ' -f2) + gh release create "${{ github.ref }}" --draft --generate-notes + for PKG in AppImage deb rpm zip; do + gh release upload "${{ github.ref }}" "dist/${REL_VER}/quickgui-${REL_VER}-linux.${PKG}" --clobber + done + if [ "$(gh release view "${{ github.ref }}" --json assets --template '{{len .assets}}')" -lt 0 ]; then + exit 1 + fi + gh release edit "${{ github.ref }}" --draft=false diff --git a/.gitignore b/.gitignore index 3f1b889..961b85d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .dart_tool/ .packages build/ +dist/ # If you're building an application, you may want to check-in your pubspec.lock pubspec.lock diff --git a/distribute_options.yaml b/distribute_options.yaml new file mode 100644 index 0000000..cd4cae6 --- /dev/null +++ b/distribute_options.yaml @@ -0,0 +1,14 @@ +output: dist/ +releases: + - name: dev + jobs: + - name: quickgui-dev-linux + package: + platform: linux + target: deb + build_args: + flavor: dev + target-platform: linux-x86 + dart-define: + APP_ENV: dev + publish_to: none diff --git a/linux/packaging/appimage/make_config.yaml b/linux/packaging/appimage/make_config.yaml new file mode 100644 index 0000000..b5c023d --- /dev/null +++ b/linux/packaging/appimage/make_config.yaml @@ -0,0 +1,25 @@ +appId: com.github.quickemu-project.quickgui +display_name: Quickgui +icon: assets/images/logo_pink.png + +keywords: + - QEMU + - quickemu + - quickget + - Virtual Machine + - Hypervisor + - macOS + - Windows + +generic_name: Desktop frontend for Quickget and Quickemu + +categories: + - System + - Development + - Emulator + +startup_notify: true + +# You can also specify [metainfo](https://freedesktop.org/software/appstream/docs/chap-Quickstart.html) file +# which contains metadata of the app. +# metainfo: linux/packaging/myappid.appdata.xml diff --git a/linux/packaging/deb/make_config.yaml b/linux/packaging/deb/make_config.yaml new file mode 100644 index 0000000..2ca7afa --- /dev/null +++ b/linux/packaging/deb/make_config.yaml @@ -0,0 +1,41 @@ +display_name: Quickgui +package_name: quickgui +maintainer: + name: Mark Johnson + email: mark@barrenfrozenwasteland.com +co_authors: + - name: Martin Wimpress + email: code@wimpress.io + - name: Yannick Mauray + email: yannick.mauray@gmail.com +priority: optional +section: x11 +installed_size: 16777216 +essential: false +icon: assets/images/logo_pink.png +dependencies: + - zenity +recommended_dependencies: + - quickemu + +keywords: + - QEMU + - quickemu + - quickget + - Virtual Machine + - Hypervisor + - macOS + - Windows + +generic_name: Desktop frontend for Quickget and Quickemu + +categories: + - System + - Development + - Emulator + +startup_notify: true + +# You can also specify [metainfo](https://freedesktop.org/software/appstream/docs/chap-Quickstart.html) file +# which contains metadata of the app. +# metainfo: linux/packaging/myappid.appdata.xml diff --git a/linux/packaging/rpm/make_config.yaml b/linux/packaging/rpm/make_config.yaml new file mode 100644 index 0000000..e2a31df --- /dev/null +++ b/linux/packaging/rpm/make_config.yaml @@ -0,0 +1,32 @@ +display_name: Quickgui +group: Application/Emulator +vendor: Quickemu Project +packager: Martin Wimpress +packagerEmail: code@wimpress.io +license: MIT +url: https://github.com/quickemu-project/quickgui +icon: assets/images/logo_pink.png +requires: + - zenity + +keywords: + - QEMU + - quickemu + - quickget + - Virtual Machine + - Hypervisor + - macOS + - Windows + +summary: Desktop frontend for Quickget and Quickemu + +categories: + - System + - Development + - Emulator + +startup_notify: true + +# You can also specify [metainfo](https://freedesktop.org/software/appstream/docs/chap-Quickstart.html) file +# which contains metadata of the app. +# metainfo: linux/packaging/myappid.appdata.xml diff --git a/pubspec.yaml b/pubspec.yaml index 0a04eec..d9271f6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: quickgui -description: A new Flutter project. +description: Desktop frontend for Quickget and Quickemu publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.2.8+1 @@ -13,7 +13,7 @@ dependencies: flutter_localizations: sdk: flutter cupertino_icons: ^1.0.2 - window_size: + window_size: git: url: https://github.com/google/flutter-desktop-embedding.git path: plugins/window_size @@ -35,6 +35,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + flutter_distributor: ^0.4.5 flutter_lints: ^4.0.0 flutter: