Files
J621/deploy/build_desktop.sh
T
JakeBreath 041a9d4471 Keep desktop builds and the feed to one version
Both scripts now read the version from desktop/package.json: the build
report and checksums only cover the current version's artifacts, the feed
copy ignores older files, and publishing prunes previous installers from
the feed (latest*.yml only ever points at the current one).
2026-09-20 21:11:19 -05:00

67 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Build the J621 desktop packages into desktop/release/ — Arch (.pkg.tar.zst),
# Debian (.deb) and the Windows NSIS installer. Nothing is published: install
# the package locally, hand the files out, or attach them to a Gitea release
# manually. Use push_desktop.sh when the in-app update feed should get them.
#
# Usage: ./build_desktop.sh [--linux | --win | --all]
# --linux Arch + Debian packages only
# --win Windows installer only (cross-built with wine)
# --all everything (default)
set -euo pipefail
cd "$(dirname "$0")/.."
TARGET="${1:---all}"
case "$TARGET" in
--linux) TARGET=linux ;;
--win) TARGET=win ;;
--all) TARGET=all ;;
*)
echo "usage: $0 [--linux|--win|--all]" >&2
exit 2
;;
esac
if [ ! -d desktop/node_modules ]; then
echo "==> Installing desktop dependencies ..."
npm --prefix desktop ci --no-audit --no-fund
fi
if [ "$TARGET" != "linux" ] && ! command -v wine >/dev/null 2>&1; then
echo "==> wine is not installed; the Windows installer needs it." >&2
exit 1
fi
case "$TARGET" in
linux) npm --prefix desktop run dist:linux ;;
win) npm --prefix desktop run dist:win ;;
all) npm --prefix desktop run dist:all ;;
esac
VERSION="$(node -p "require('./desktop/package.json').version")"
case "$TARGET" in
linux) ARTIFACTS=(-name "*${VERSION}*.deb" -o -name "*${VERSION}*.pkg.tar.zst") ;;
win) ARTIFACTS=(-name "*${VERSION}*.exe") ;;
all) ARTIFACTS=(-name "*${VERSION}*.deb" -o -name "*${VERSION}*.pkg.tar.zst" -o -name "*${VERSION}*.exe") ;;
esac
echo
echo "==> Artifacts in desktop/release/:"
find desktop/release -maxdepth 1 -type f \( "${ARTIFACTS[@]}" \) \
-printf '%s\t%p\n' |
sort -rn |
while IFS=$'\t' read -r size file; do
printf ' %8s %s\n' "$(numfmt --to=iec "$size")" "$file"
done
echo
echo "==> SHA-256 (for release notes):"
find desktop/release -maxdepth 1 -type f \( "${ARTIFACTS[@]}" \) \
-exec sha256sum {} + | sed 's/^/ /'
echo
echo "==> J621 desktop $VERSION built."
echo " Install here: sudo pacman -U desktop/release/j621-desktop-*.pkg.tar.zst"
echo " Gitea release tag: desktop-v$VERSION"