release: zip Windows artefacts with 7-Zip or PowerShell when zip isn't installed (GitHub's Windows runners have no zip)

This commit is contained in:
Andy Dixon
2026-10-13 13:16:25 +01:00
parent 35ddd1010a
commit 7671826fdf
+9 -1
View File
@@ -72,7 +72,15 @@ for target in "${TARGETS[@]}"; do
;; ;;
windows) windows)
cp "$bin.exe" "$OUT/$base.exe" cp "$bin.exe" "$OUT/$base.exe"
(cd "$OUT" && rm -f "$base.zip" && zip -qj "$base.zip" "$base.exe" "$ROOT/LICENSE") # GitHub's Windows runners have 7-Zip but no zip.
if command -v zip >/dev/null; then
(cd "$OUT" && rm -f "$base.zip" && zip -qj "$base.zip" "$base.exe" "$ROOT/LICENSE")
elif command -v 7z >/dev/null; then
(cd "$OUT" && rm -f "$base.zip" && cp "$ROOT/LICENSE" LICENSE && 7z a -tzip -bso0 -bsp0 "$base.zip" "$base.exe" LICENSE && rm -f LICENSE)
else
(cd "$OUT" && rm -f "$base.zip" && cp "$ROOT/LICENSE" LICENSE &&
powershell -NoProfile -NonInteractive -Command "Compress-Archive -Path '$base.exe','LICENSE' -DestinationPath '$base.zip' -Force" && rm -f LICENSE)
fi
;; ;;
*) *)
cp "$bin" "$OUT/$base" cp "$bin" "$OUT/$base"