#!/bin/bash # Build the J621 desktop packages and publish them to the frontend's update # feed (deploy/data/desktop, mounted read-only into the frontend nginx and # served at /desktop/). electron-updater reads latest-linux.yml / latest.yml # from there; the app's feed URL comes from desktop/electron-builder.yml. # # Usage: ./push_desktop.sh [--win] [--no-build] # --win also cross-build the Windows NSIS installer (needs wine) # --no-build publish what is already in desktop/release/ set -euo pipefail cd "$(dirname "$0")/.." BUILD=1 WIN=0 for arg in "$@"; do case "$arg" in --win) WIN=1 ;; --no-build) BUILD=0 ;; *) echo "usage: $0 [--win] [--no-build]" >&2 exit 2 ;; esac done if [ "$BUILD" = 1 ]; then echo "==> Building Linux packages (deb + pacman) ..." npm --prefix desktop run dist:linux if [ "$WIN" = 1 ]; then echo "==> Cross-building the Windows installer (wine) ..." npm --prefix desktop run dist:win fi fi FEED=deploy/data/desktop mkdir -p "$FEED" shopt -s nullglob deb=(desktop/release/*.deb) zst=(desktop/release/*.pkg.tar.zst) linux_meta=(desktop/release/latest-linux.yml) win_exe=("desktop/release/J621 Setup "*.exe) win_meta=(desktop/release/latest.yml) blockmaps=(desktop/release/*.blockmap) if [ "${#deb[@]}" -eq 0 ] && [ "${#zst[@]}" -eq 0 ]; then echo "No artifacts in desktop/release/ — run without --no-build first." >&2 exit 1 fi # Replace the previous release's metadata before copying the new artifacts. rm -f "$FEED"/latest-linux.yml "$FEED"/latest.yml cp -f "${deb[@]}" "${zst[@]}" "${linux_meta[@]}" "$FEED"/ 2>/dev/null || true if [ "${#win_exe[@]}" -gt 0 ]; then cp -f "${win_exe[@]}" "${win_meta[@]}" "${blockmaps[@]}" "$FEED"/ 2>/dev/null || true fi echo "==> Published to $FEED:" ls -1sh "$FEED" | sed 's/^/ /' echo echo "Served read-only by the frontend nginx at /desktop/ (no restart needed):" echo " https:///desktop/latest-linux.yml"