Prune old desktop builds from release/ on every build

build_desktop.sh now reads the version first and removes anything in
desktop/release/ that is not that version (plus the regenerated unpacked
trees), so a version bump never leaves old installers lying around — the
same rule push_desktop.sh applies to the feed.
This commit is contained in:
2026-09-20 21:16:56 -05:00
parent 041a9d4471
commit 3183a3bece
+15 -2
View File
@@ -22,6 +22,8 @@ case "$TARGET" in
;;
esac
VERSION="$(node -p "require('./desktop/package.json').version")"
if [ ! -d desktop/node_modules ]; then
echo "==> Installing desktop dependencies ..."
npm --prefix desktop ci --no-audit --no-fund
@@ -32,14 +34,25 @@ if [ "$TARGET" != "linux" ] && ! command -v wine >/dev/null 2>&1; then
exit 1
fi
# release/ should only ever hold the current version: old installers are
# rebuilt from git when needed, and the unpacked trees are regenerated.
shopt -s nullglob
stale=(desktop/release/*.deb desktop/release/*.pkg.tar.zst desktop/release/"J621 Setup "*.exe
desktop/release/*.blockmap desktop/release/latest*.yml)
for file in "${stale[@]}"; do
case "$(basename "$file")" in
*"$VERSION"*) ;;
*) echo " removing $(basename "$file")"; rm -f "$file" ;;
esac
done
rm -rf desktop/release/linux-unpacked desktop/release/win-unpacked
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") ;;