Compare commits

...
Author SHA1 Message Date
Sapphire 62188a8473 fixup! Bundle JRE for AppImage
add checksum and other various sanity checks, deduplicate electron-builder args, more detailed comment
2026-12-06 11:34:56 -05:00
Sapphire dbae1e27eb Bundle JRE for AppImage 2026-12-06 11:13:43 -05:00
2 changed files with 49 additions and 4 deletions

No files matched your search

+46 -4
View File
@@ -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,51 @@ jobs:
VERSION="${VERSION#v}"
echo "Building version: $VERSION"
pnpm i
cd gui/electron
pnpm exec electron-builder --${{ matrix.platform }} \
cd "${{ github.workspace }}/gui/electron"
COMMON_ELECTRON_BUILDER_ARGS=(--config.extraMetadata.version="$VERSION" --publish never)
# If Linux, build rpm and deb before AppImage (so we don't bundle jre for system packages)
pnpm exec electron-builder --${{ matrix.platform }} \
${{ matrix.platform == 'macos' && '--universal' || '' }} \
--config.extraMetadata.version="$VERSION" \
--publish never
${{ matrix.platform == 'linux' && 'rpm deb' || ''}} \
${COMMON_ELECTRON_BUILDER_ARGS[@]}
# Fetch JRE from Adoptium and build AppImage
# We have to do this afterward because electron-builder does not have a mechanism to
# only include a file in extraFiles for a specific target (i.e. only for 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')"
EXPECTED_JRE_ARCHIVE_CHECKSUM="$(echo "$LATEST_JRE_INFO" | jq -r '.[0].binary.package.checksum')"
echo "Downloading Adoptium Eclipse JRE version $JRE_VERSION ($JRE_ARCHIVE_URL)"
# Make sure name is not a weird relative path
[[ "$(dirname "$(realpath "$JRE_ARCHIVE_NAME")")" != "$(pwd)" ]] && { echo "JRE archive name is a weird path, refusing to continue" >&2; exit 1; }
# Same with version
[[ "$(dirname "$(realpath "$JRE_VERSION")")" != "$(pwd)" ]] && { echo "JRE version is a weird path, refusing to continue" >&2; exit 1; }
curl -Lf "$JRE_ARCHIVE_URL" -O
[[ ! -f "$JRE_ARCHIVE_NAME" ]] && { echo "JRE archive does not exist with filename $JRE_ARCHIVE_NAME" >&2; exit 1; }
# Make sure checksum matches
JRE_ARCHIVE_CHECKSUM="$(sha256sum "$JRE_ARCHIVE_NAME" | cut -d' ' -f1)"
[[ "$JRE_ARCHIVE_CHECKSUM" != "$EXPECTED_JRE_ARCHIVE_CHECKSUM" ]] && { echo "JRE checksum does not match ($JRE_ARCHIVE_CHECKSUM != $EXPECTED_JRE_ARCHIVE_CHECKSUM)" >&2; exit 1; }
tar -xzf "$JRE_ARCHIVE_NAME"
mv "${JRE_VERSION}-jre" jre
popd
# Now run AppImage build
pnpm exec electron-builder --${{ matrix.platform }} appimage ${COMMON_ELECTRON_BUILDER_ARGS[@]}
fi
- name: Collect and Rename Artifacts
shell: bash
run: |
+3
View File
@@ -53,6 +53,9 @@ linux:
to: "."
- from: "./resources/firewall"
to: "firewall"
# Exists in CI when building for AppImage
- from: "./resources/jre"
to: "jre"
icon: "./resources/icons"
deb: