Files
Amber/desktop/packaging/linux.sh
T
greenart7c3andClaude Opus 5.5 573690eebd desktop: release workflow, AppImage and tar.xz for Linux
- desktop-release.yml: on v* tags, builds every desktop installer with the
  tag's version (via desktop.yml, now also a reusable workflow) and attaches
  them to the tag's GitHub release.
- desktop/packaging/linux.sh: builds a distro-independent .tar.xz and an
  .AppImage from the createDistributable image; CI smoke-tests the AppImage.
- Installers are named Amber-<version>-<platform>.<ext> so the arm64 and x64
  DMGs no longer collide.
- packageVersion can be overridden with -PdesktopVersion.
- Inside an AppImage, use $APPIMAGE for the nostrconnect:// handler and the
  start-on-boot unit: the binary's own path is a per-launch mount.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 07:32:09 -03:00

60 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Builds the distro-independent Linux bundles from the jpackage app image
# (./gradlew :desktop:createDistributable):
#
# Amber-<version>-linux-x86_64.tar.xz unpack anywhere, run Amber/bin/Amber
# Amber-<version>-x86_64.AppImage single self-contained executable
#
# desktop/packaging/linux.sh <version> <out-dir>
#
# Needs curl (to fetch appimagetool) and xz. FUSE is not needed: appimagetool
# runs with APPIMAGE_EXTRACT_AND_RUN.
set -euo pipefail
version=${1:?usage: linux.sh <version> <out-dir>}
out=${2:?usage: linux.sh <version> <out-dir>}
here=$(cd "$(dirname "$0")" && pwd)
desktop=$(cd "$here/.." && pwd)
image="$desktop/build/compose/binaries/main/app/Amber"
work="$desktop/build/linux-bundles"
[ -x "$image/bin/Amber" ] || { echo "No app image at $image; run :desktop:createDistributable first" >&2; exit 1; }
mkdir -p "$out"
out=$(cd "$out" && pwd)
rm -rf "$work"
mkdir -p "$work"
tar -C "$(dirname "$image")" -cJf "$out/Amber-$version-linux-x86_64.tar.xz" Amber
appdir="$work/Amber.AppDir"
mkdir -p "$appdir/usr/lib"
cp -a "$image" "$appdir/usr/lib/amber"
cp "$desktop/src/main/resources/icon.png" "$appdir/amber.png"
ln -s amber.png "$appdir/.DirIcon"
# StartupWMClass matches the X11 class Main.kt sets, so docks show this icon.
cat > "$appdir/amber.desktop" << 'EOF'
[Desktop Entry]
Type=Application
Name=Amber
Comment=Nostr event signer
Exec=Amber %u
Icon=amber
Categories=Network;
Terminal=false
StartupWMClass=Amber
MimeType=x-scheme-handler/nostrconnect;
EOF
cat > "$appdir/AppRun" << 'EOF'
#!/bin/sh
here=$(dirname "$(readlink -f "$0")")
exec "$here/usr/lib/amber/bin/Amber" "$@"
EOF
chmod +x "$appdir/AppRun"
tool="$work/appimagetool"
curl -fsSL -o "$tool" https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x "$tool"
ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 "$tool" --no-appstream "$appdir" "$out/Amber-$version-x86_64.AppImage"
ls -l "$out"