From 2c436e2027b7f5bcd3a47d87491bb445245c8dd6 Mon Sep 17 00:00:00 2001 From: KamaleiZestri <38802353+KamaleiZestri@users.noreply.github.com> Date: Mon, 14 Jul 2025 17:51:09 -0500 Subject: [PATCH] Add AppImage bundle (#1519) * Add AppImage build * add appimage package variable name * Add workflows --------- Co-authored-by: Syer10 --- .github/workflows/build_push.yml | 43 ++++++++++++++++++++----------- .github/workflows/publish.yml | 41 +++++++++++++++++++---------- scripts/bundler.sh | 29 +++++++++++++++++++++ scripts/resources/appimage/AppRun | 3 +++ 4 files changed, 87 insertions(+), 29 deletions(-) create mode 100644 scripts/resources/appimage/AppRun diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index 66b87770f..739caae01 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -112,16 +112,25 @@ jobs: strategy: fail-fast: false matrix: - os: - - debian-all - - linux-assets - - linux-x64 - - macOS-x64 - - macOS-arm64 - - windows-x64 + include: + - name: debian-all + jre: linux-x64 + - name: appimage + jre: linux-x64 + - name: linux-assets + jre: linux-assets + - name: linux-x64 + jre: linux-x64 + - name: macOS-x64 + jre: macOS-x64 + - name: macOS-arm64 + jre: macOS-arm64 + - name: windows-x64 + jre: windows-x64 + name: [debian-all, appimage, linux-assets, linux-x64, macOS-x64, macOS-arm64, windows-x64] - name: Make ${{ matrix.os }} release - needs: [build,jlink] + name: Make ${{ matrix.name }} release + needs: [build, jlink] runs-on: ubuntu-latest steps: - name: Download Jar @@ -132,9 +141,9 @@ jobs: - name: Download JRE uses: actions/download-artifact@v4 - if: matrix.os != 'linux-assets' && matrix.os != 'debian-all' + if: matrix.name != 'linux-assets' && matrix.name != 'debian-all' with: - name: ${{ matrix.os }}-jre + name: ${{ matrix.jre }}-jre path: jre - name: Download icons @@ -148,16 +157,16 @@ jobs: with: name: scripts - - name: Make ${{ matrix.os }} release + - name: Make ${{ matrix.name }} release run: | mkdir upload tar -xvpf scripts.tar.gz - scripts/bundler.sh -o upload/ ${{ matrix.os }} + scripts/bundler.sh -o upload/ ${{ matrix.name }} - - name: Upload ${{ matrix.os }} release + - name: Upload ${{ matrix.name }} release uses: actions/upload-artifact@v4 with: - name: ${{ matrix.os }} + name: ${{ matrix.name }} path: upload/* if-no-files-found: error @@ -173,6 +182,10 @@ jobs: with: name: debian-all path: release + - uses: actions/download-artifact@v4 + with: + name: appimage + path: release - uses: actions/download-artifact@v4 with: name: linux-assets diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e3b9061d1..1927849dd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -114,15 +114,24 @@ jobs: strategy: fail-fast: false matrix: - os: - - debian-all - - linux-assets - - linux-x64 - - macOS-x64 - - macOS-arm64 - - windows-x64 + include: + - name: debian-all + jre: linux-x64 + - name: appimage + jre: linux-x64 + - name: linux-assets + jre: linux-assets + - name: linux-x64 + jre: linux-x64 + - name: macOS-x64 + jre: macOS-x64 + - name: macOS-arm64 + jre: macOS-arm64 + - name: windows-x64 + jre: windows-x64 + name: [debian-all, appimage, linux-assets, linux-x64, macOS-x64, macOS-arm64, windows-x64] - name: Make ${{ matrix.os }} release + name: Make ${{ matrix.name }} release needs: [build, jlink] runs-on: ubuntu-latest steps: @@ -134,9 +143,9 @@ jobs: - name: Download JRE uses: actions/download-artifact@v4 - if: matrix.os != 'linux-assets' && matrix.os != 'debian-all' + if: matrix.name != 'linux-assets' && matrix.name != 'debian-all' with: - name: ${{ matrix.os }}-jre + name: ${{ matrix.jre }}-jre path: jre - name: Download icons @@ -150,16 +159,16 @@ jobs: with: name: scripts - - name: Make ${{ matrix.os }} release + - name: Make ${{ matrix.name }} release run: | mkdir upload/ tar -xvpf scripts.tar.gz - scripts/bundler.sh -o upload/ ${{ matrix.os }} + scripts/bundler.sh -o upload/ ${{ matrix.name }} - - name: Upload ${{ matrix.os }} files + - name: Upload ${{ matrix.name }} files uses: actions/upload-artifact@v4 with: - name: ${{ matrix.os }} + name: ${{ matrix.name }} path: upload/* if-no-files-found: error @@ -176,6 +185,10 @@ jobs: with: name: debian-all path: release + - uses: actions/download-artifact@v4 + with: + name: appimage + path: release - uses: actions/download-artifact@v4 with: name: linux-assets diff --git a/scripts/bundler.sh b/scripts/bundler.sh index aef0a587e..35f28a860 100755 --- a/scripts/bundler.sh +++ b/scripts/bundler.sh @@ -48,6 +48,19 @@ main() { make_deb_package move_release_to_output_dir ;; + appimage) + # https://github.com/adoptium/temurin21-binaries/releases/ + JRE_RELEASE="jdk-21.0.7+6" + JRE="OpenJDK21U-jre_x64_linux_hotspot_$(echo "$JRE_RELEASE" | sed 's/jdk//;s/-//g;s/+/_/g').tar.gz" + JRE_DIR="$JRE_RELEASE-jre" + JRE_URL="https://github.com/adoptium/temurin21-binaries/releases/download/$JRE_RELEASE/$JRE" + setup_jre + + RELEASE="$RELEASE_NAME.AppImage" + APPIMAGE_URL="https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" + make_appimage + move_release_to_output_dir + ;; linux-assets) RELEASE="$RELEASE_NAME.tar.gz" copy_linux_package_assets_to "$RELEASE_NAME/" @@ -230,6 +243,22 @@ make_deb_package() { mv "$RELEASE_NAME/$deb" "$RELEASE" } +# https://linuxconfig.org/building-a-hello-world-appimage-on-linux +make_appimage() { + local APPIMAGE_TOOLNAME="appimagetool-x86_64.AppImage" + mkdir "$RELEASE_NAME/bin/" + cp "$JAR" "$RELEASE_NAME/bin/Suwayomi-Server.jar" + + cp "scripts/resources/pkg/suwayomi-server.desktop" "$RELEASE_NAME/suwayomi-server.desktop" + cp "server/src/main/resources/icon/faviconlogo.png" "$RELEASE_NAME/suwayomi-server.png" + cp "scripts/resources/appimage/AppRun" "$RELEASE_NAME/AppRun" + chmod +x "$RELEASE_NAME/AppRun" + + curl -L $APPIMAGE_URL -o $APPIMAGE_TOOLNAME + chmod +x $APPIMAGE_TOOLNAME + ARCH=x86_64 ./$APPIMAGE_TOOLNAME "$RELEASE_NAME" "$RELEASE" +} + make_windows_bundle() { ## I disabled this section until someone find a solution to this error: ##E: Unable to correct problems, you have held broken packages. diff --git a/scripts/resources/appimage/AppRun b/scripts/resources/appimage/AppRun new file mode 100644 index 000000000..711007904 --- /dev/null +++ b/scripts/resources/appimage/AppRun @@ -0,0 +1,3 @@ +#!/bin/sh + +exec $APPDIR/jre/bin/java -jar $APPDIR/bin/Suwayomi-Server.jar