From dbae1e27ebdbc2731423148d974e083ce114b0e0 Mon Sep 17 00:00:00 2001 From: Sapphire Date: Sun, 6 Dec 2026 11:13:43 -0500 Subject: [PATCH] Bundle JRE for AppImage --- .github/workflows/build.yml | 37 ++++++++++++++++++++++++++++--- gui/electron/electron-builder.yml | 2 ++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 791d7949e..eccf91a07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -207,6 +207,8 @@ jobs: - name: Run Electron Builder shell: bash run: | + set -eo pipefail + mkdir -p gui/electron/dist/artifacts/linux/ \ gui/electron/dist/artifacts/win \ gui/electron/dist/artifacts/mac @@ -215,11 +217,40 @@ jobs: VERSION="${VERSION#v}" echo "Building version: $VERSION" pnpm i - cd gui/electron - pnpm exec electron-builder --${{ matrix.platform }} \ + cd "${{ github.workspace }}/gui/electron" + + # If Linux, build rpm and deb before AppImage (to exclude jre) + pnpm exec electron-builder --${{ matrix.platform }} \ ${{ matrix.platform == 'macos' && '--universal' || '' }} \ - --config.extraMetadata.version="$VERSION" \ + ${{ matrix.platform == 'linux' && 'rpm deb' || ''}} \ + --config.extraMetadata.version="$VERSION" \ --publish never + + # Grab JRE for AppImage and build AppImage + if [[ "${{ matrix.platform }}" == linux ]]; then + pushd resources + + # Fetch JRE from Adoptium + JRE_ARCHITECTURE="${{ endsWith(matrix.os, '-arm') && 'aarch64' || 'x64' }}" + LATEST_JRE_INFO="$(curl -f "https://api.adoptium.net/v3/assets/latest/25/hotspot?architecture=$JRE_ARCHITECTURE&image_type=jre&os=linux&vendor=eclipse")" + + JRE_VERSION="$(echo $LATEST_JRE_INFO | jq -r '.[0].release_name')" + JRE_ARCHIVE_URL="$(echo $LATEST_JRE_INFO | jq -r '.[0].binary.package.link')" + JRE_ARCHIVE_NAME="$(echo $LATEST_JRE_INFO | jq -r '.[0].binary.package.name')" + JRE_ARCHIVE_CHECKSUM="$(echo $LATEST_JRE_INFO | jq -r '.[0].binary.package.checksum')" + echo "Downloading Adoptium Eclipse JRE version $JRE_VERSION ($JRE_ARCHIVE_URL)" + + curl -Lf "$JRE_ARCHIVE_URL" -O + [[ ! -f "$JRE_ARCHIVE_NAME" ]] && exit 1 + + tar -xzf "$JRE_ARCHIVE_NAME" + mv "${JRE_VERSION}-jre" jre + + popd + + # Now run AppImage build + pnpm exec electron-builder --${{ matrix.platform }} appimage --config.extraMetadata.version="$VERSION" --publish never + fi - name: Collect and Rename Artifacts shell: bash run: | diff --git a/gui/electron/electron-builder.yml b/gui/electron/electron-builder.yml index 4cf816f59..79b4c40b0 100644 --- a/gui/electron/electron-builder.yml +++ b/gui/electron/electron-builder.yml @@ -53,6 +53,8 @@ linux: to: "." - from: "./resources/firewall" to: "firewall" + - from: "./resources/jre" + to: "jre" icon: "./resources/icons" deb: