feat(desktop): wire up HealthChat auto-update + public installer hosting

The Electron auto-updater (Squirrel.Mac / Squirrel.Windows) was already
implemented but switched off for HealthChat because the variant config
omitted update_base_url, and CI published only installers (no update feed),
to a private GitHub Release that can't serve end users or the updater.

- config.json: set update_base_url to https://healthchat.ch/packages/desktop/update/
  so electron-main starts the updater.
- build-healthchat-desktop.yaml: pass base-url to the macOS job so releases.json
  is generated; extend the release job to stage the update feed + public
  installers and mirror them to healthchat.ch over FTPS (lftp, no-delete to
  preserve prior nupkgs; password via LFTP_PASSWORD).
- Document the feed/install layout, FTP secrets, and the two caveats (first
  install is manual; Windows auto-update needs the Setup.exe path, not .msi)
  in the healthchat README and the releasing-healthchat skill.

Requires repo secrets FTP_SERVER / FTP_USERNAME / FTP_PASSWORD.
This commit is contained in:
2026-06-28 09:54:08 +02:00
parent bd6241ad9d
commit ade1dff201
4 changed files with 112 additions and 3 deletions
@@ -189,6 +189,12 @@ jobs:
sign: true
test: false
targets: "dmg zip"
# Generates dist/releases.json (the Squirrel.Mac feed manifest). The reusable appends
# `/update/macos/<zip>` to this, so the in-manifest URL becomes
# https://healthchat.ch/packages/desktop/update/macos/<zip>, matching where the
# `release` job publishes the feed. Keep in sync with update_base_url in
# element.io/healthchat/config.json (.../packages/desktop/update/).
base-url: https://healthchat.ch/packages/desktop
windows:
name: Windows ${{ matrix.arch }}
@@ -255,3 +261,64 @@ jobs:
gh release view "$TAG" >/dev/null 2>&1 || \
gh release create "$TAG" --title "$TAG" --notes "HealthChat desktop installers for $TAG"
gh release upload "$TAG" release-files/* --clobber
# The GitHub Release above is private (internal fork), so it can't serve end users or the
# Squirrel auto-updater. Mirror the update feed + public installers to healthchat.ch over
# FTPS so installed apps self-update (update_base_url -> .../packages/desktop/update/) and
# users can download from a public URL (.../packages/desktop/install/).
- name: Stage update feed + public installers
run: |
set -euo pipefail
# --- macOS update feed: releases.json (Squirrel.Mac manifest) + signed *-mac.zip payload ---
mkdir -p feed/update/macos feed/install/macos
test -f dist-artifacts/macos/releases.json || {
echo "::error::dist-artifacts/macos/releases.json missing (did the macos job get base-url?)"; exit 1; }
cp -v dist-artifacts/macos/releases.json feed/update/macos/
find dist-artifacts/macos -type f -iname '*-mac.zip' -exec cp -v {} feed/update/macos/ \;
# --- macOS installer: versioned .dmg + a stable "latest" copy ---
find dist-artifacts/macos -type f -iname '*.dmg' -exec cp -v {} feed/install/macos/ \;
dmg=$(find feed/install/macos -type f -iname '*.dmg' | head -n1)
test -n "$dmg" && cp -v "$dmg" feed/install/macos/HealthChat.dmg
# --- Windows: per-arch Squirrel feed (RELEASES + full nupkg) + installers (Setup.exe, msi) ---
for arch in x64 arm64; do
src="dist-artifacts/win-$arch"
[ -d "$src" ] || { echo "::error::$src missing"; exit 1; }
mkdir -p "feed/update/win32/$arch" "feed/install/win32/$arch"
find "$src" -type f -iname 'RELEASES' -exec cp -v {} "feed/update/win32/$arch/" \;
find "$src" -type f -iname '*-full.nupkg' -exec cp -v {} "feed/update/win32/$arch/" \;
find "$src" -type f -iname '* Setup*.exe' -exec cp -v {} "feed/install/win32/$arch/" \;
find "$src" -type f -iname '*.msi' -exec cp -v {} "feed/install/win32/$arch/" \;
setup=$(find "feed/install/win32/$arch" -type f -iname '* Setup*.exe' | head -n1)
test -n "$setup" && cp -v "$setup" "feed/install/win32/$arch/HealthChat-Setup.exe"
done
echo "--- staged feed tree ---"
find feed -type f | sort
- name: Install lftp
run: sudo apt-get update && sudo apt-get install -y lftp
- name: Publish to healthchat.ch over FTPS
env:
FTP_SERVER: ${{ secrets.FTP_SERVER }}
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
# Passed to lftp via LFTP_PASSWORD (--env-password) so it never appears on the
# command line / process list.
LFTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
run: |
set -euo pipefail
: "${FTP_SERVER:?FTP_SERVER secret not set}"
: "${FTP_USERNAME:?FTP_USERNAME secret not set}"
: "${LFTP_PASSWORD:?FTP_PASSWORD secret not set}"
# mirror -R (reverse) uploads the local tree; default is no-delete, so prior
# *.nupkg are preserved (Squirrel.Windows delta history) and only the staged files
# are written/overwritten. If the host's FTPS cert is untrusted, set
# ssl:verify-certificate to no.
lftp -u "$FTP_USERNAME" --env-password "$FTP_SERVER" <<'LFTP'
set cmd:fail-exit true
set ftp:ssl-force true
set ftp:ssl-protect-data true
set ssl:verify-certificate true
mkdir -pf /public_html/healthchat.ch/packages/desktop
mirror -R --parallel=4 --verbose feed/ /public_html/healthchat.ch/packages/desktop/
bye
LFTP