From 1fbd6f7dfb48363effc64948a133461cffd97b3b Mon Sep 17 00:00:00 2001 From: Jacob Schlecht Date: Sat, 15 Aug 2026 15:38:41 -0600 Subject: [PATCH] feat: Add AppImage build flow to release (#271) * Add files via upload Signed-off-by: Arakandai <113034028+NewMasterDai@users.noreply.github.com> * Update build-appimage.yml requested changes Signed-off-by: Arakandai <113034028+NewMasterDai@users.noreply.github.com> * feat: App image build to release please Signed-off-by: Jacob Schlecht --------- Signed-off-by: Arakandai <113034028+NewMasterDai@users.noreply.github.com> Signed-off-by: Jacob Schlecht Co-authored-by: Arakandai <113034028+NewMasterDai@users.noreply.github.com> --- .github/build/appimage/extract-artifact.sh | 13 ++++ .github/build/appimage/get-dependencies.sh | 11 +++ .github/build/appimage/make-appimage.sh | 24 ++++++ .github/workflows/release-please.yml | 87 +++++++++++++++++----- .mise/tasks/make/_default | 9 ++- 5 files changed, 124 insertions(+), 20 deletions(-) create mode 100644 .github/build/appimage/extract-artifact.sh create mode 100644 .github/build/appimage/get-dependencies.sh create mode 100644 .github/build/appimage/make-appimage.sh diff --git a/.github/build/appimage/extract-artifact.sh b/.github/build/appimage/extract-artifact.sh new file mode 100644 index 0000000..b635435 --- /dev/null +++ b/.github/build/appimage/extract-artifact.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -eu + +echo "Extracting Artifact..." +echo "---------------------------------------------------------------" + +mkdir -p ./AppDir/bin +unzip /tmp/stoat/Stoat-linux-*.zip +mv -v ./Stoat-linux-"$BUILD_ARCH"/* ./AppDir/bin + +echo "Packaging as version $BUILD_VERSION" +echo "$BUILD_VERSION" > ~/version \ No newline at end of file diff --git a/.github/build/appimage/get-dependencies.sh b/.github/build/appimage/get-dependencies.sh new file mode 100644 index 0000000..a800d68 --- /dev/null +++ b/.github/build/appimage/get-dependencies.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -eu + +echo "Installing package dependencies..." +echo "---------------------------------------------------------------" +pacman -Syu --noconfirm libnss_nis nss-mdns nss pipewire + +echo "Installing debloated packages..." +echo "---------------------------------------------------------------" +get-debloated-pkgs --add-common --prefer-nano \ No newline at end of file diff --git a/.github/build/appimage/make-appimage.sh b/.github/build/appimage/make-appimage.sh new file mode 100644 index 0000000..1cbe0f6 --- /dev/null +++ b/.github/build/appimage/make-appimage.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +set -eu + +ARCH=$(uname -m) +export ARCH +export OUTPATH=./dist +export ADD_HOOKS="self-updater.hook" +export UPINFO="gh-releases-zsync|${GITHUB_REPOSITORY%/*}|${GITHUB_REPOSITORY#*/}|latest|*$ARCH.AppImage.zsync" +export ICON=https://raw.githubusercontent.com/stoatchat/assets/f106946659af67ad4f008588ac51570029b2fd47/desktop/icon.png +export DESKTOP=https://raw.githubusercontent.com/stoatchat/for-desktop/refs/heads/main/chat.stoat.StoatDesktop.desktop +export DEPLOY_PIPEWIRE=1 + +# Deploy dependencies +quick-sharun ./AppDir/bin/* + +# Additional changes can be done in between here + +# Turn AppDir into AppImage +quick-sharun --make-appimage + +# Test the app for 12 seconds, if the test fails due to the app +# having issues running in the CI use --simple-test instead +quick-sharun --test ./dist/*.AppImage \ No newline at end of file diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index b6d3ef7..fbbace1 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -20,6 +20,7 @@ jobs: runs-on: ubuntu-latest outputs: release_created: ${{ steps.rp.outputs.release_created }} + release_version: ${{ steps.rp.outputs.version }} steps: - id: app-token uses: actions/create-github-app-token@v2 @@ -43,7 +44,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest, macos-26-intel] steps: - name: Checkout @@ -52,6 +53,15 @@ jobs: - name: Checkout assets run: git -c submodule."assets".update=checkout submodule update --init assets + - name: Install Flatpak Tooling and Runtimes + if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' + run: | + sudo apt-get update + sudo apt-get install -y flatpak flatpak-builder + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + flatpak install -y --user flathub org.freedesktop.Platform//25.08 org.freedesktop.Sdk//25.08 + flatpak install -y --user flathub org.electronjs.Electron2.BaseApp//stable + - name: Install pnpm uses: pnpm/action-setup@v4 with: @@ -73,25 +83,64 @@ jobs: PLATFORM: ${{ matrix.os }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Publish macOS x64 - if: matrix.os == 'macos-latest' - run: pnpm run publish --arch=x64 - env: - PLATFORM: ${{ matrix.os }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload artifact for AppImage build + if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' + uses: actions/upload-artifact@v6 + with: + name: stoat-linux-package-${{ case(matrix.os == 'ubuntu-latest', 'x64, 'arm64') }} + path: ./out/make/zip/linux/${{ case(matrix.os == 'ubuntu-latest', 'x64, 'arm64') }}/Stoat-linux-*.zip + + build-appimage: + needs: [release-please, publish-release] + if: needs.release-please.outputs.release_created == 'true' + runs-on: ${{ matrix.runs-on }} + strategy: + matrix: + runs-on: [ubuntu-latest, ubuntu-24.04-arm] + container: ghcr.io/pkgforge-dev/archlinux:latest - - name: Install Flatpak Tooling and Runtimes - if: matrix.os == 'ubuntu-latest' - run: | - sudo apt-get update - sudo apt-get install -y flatpak flatpak-builder - flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - flatpak install -y --user flathub org.freedesktop.Platform//25.08 org.freedesktop.Sdk//25.08 - flatpak install -y --user flathub org.electronjs.Electron2.BaseApp//stable + steps: + - name: Checkout + uses: actions/checkout@v6 - - name: Publish Linux arm64 - if: matrix.os == 'ubuntu-latest' - run: pnpm run publish --arch=arm64 + - name: Download Artifact + uses: actions/download-artifact@v7 + with: + name: stoat-linux-package-${{ case(matrix.os == 'ubuntu-latest', 'x64, 'arm64') }} + path: /tmp/stoat + + - name: Preparing Container + uses: pkgforge-dev/anylinux-setup-action@0964f2258d6c93d1391359978dde081fd8b3c6af # v2 + + - name: Install Dependencies + run: /bin/sh ./.github/build/appimage/get-dependencies.sh + + - name: Extract Artifact + run: /bin/sh ./.github/build/appimage/extract-artifact.sh env: - PLATFORM: ${{ matrix.os }} + BUILD_ARCH: ${{ case(matrix.os == 'ubuntu-latest', 'x64, 'arm64') }} + BUILD_VERSION: ${{ needs.release-please.outputs.release_version }} + + - name: Make & Test AppImage + run: /bin/sh ./.github/build/appimage/make-appimage.sh + + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: AppImage-${{ case(matrix.os == 'ubuntu-latest', 'x64, 'arm64') }} + path: dist + + publish-appimage: + runs-on: ubuntu-latest + needs: [release-please, build-appimage] + steps: + - name: Download Artifact + uses: actions/download-artifact@v7 + with: + pattern: AppImage-* + merge-multiple: true + + - name: Update release with AppImage + run: gh release upload ${{ needs.release-please.outputs.release_version }} Stoat-*.AppImage + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.mise/tasks/make/_default b/.mise/tasks/make/_default index e04c02a..b0a46d9 100755 --- a/.mise/tasks/make/_default +++ b/.mise/tasks/make/_default @@ -1,5 +1,12 @@ #!/usr/bin/env bash #MISE description="Make desktop app targets" +#USAGE arg "[arch]" help="Make for a specific architecture" { +#USAGE choices "x64" "arm64" +#USAGE } set -e -pnpm run make \ No newline at end of file +if [[ -z "$usage_arch" ]]; then + pnpm run make +else + pnpm run make --arch=$usage_arch +fi \ No newline at end of file