more Sparkle tests

This commit is contained in:
Micha
2025-11-25 19:03:05 +01:00
parent 57dc68f434
commit d65ec99cfb
5 changed files with 52 additions and 17 deletions

View File

@@ -29,23 +29,56 @@ find_generate_appcast() {
generate_appcast() {
local generator
generator="$(find_generate_appcast)"
local download_prefix=""
if [[ -n "${SPARKLE_DOWNLOAD_BASE_TEMPLATE:-}" ]]; then
download_prefix="${SPARKLE_DOWNLOAD_BASE_TEMPLATE//\{\{VERSION\}\}/$VERSION}"
else
download_prefix="${SPARKLE_DOWNLOAD_BASE_URL:-}"
fi
local download_prefix="${SPARKLE_DOWNLOAD_BASE_URL:-}"
local subdir_template="${SPARKLE_DOWNLOAD_SUBDIR_TEMPLATE:-}"
if [[ -z "$generator" || -z "${SPARKLE_EDDSA_KEY_FILE:-}" || -z "$download_prefix" ]]; then
echo " Skipping Sparkle appcast generation (generator/key/download prefix not configured)."
return
fi
download_prefix="${download_prefix%/}"
local output="$SPARKLE_APPCAST_OUTPUT"
mkdir -p "$(dirname "$output")"
local staging_dir
staging_dir="$(mktemp -d)"
cp "$ARTIFACTS_DIR"/*.zip "$staging_dir"/ 2>/dev/null || true
local zip_found=false
shopt -s nullglob
for zip_path in "$ARTIFACTS_DIR"/*.zip; do
zip_found=true
local filename version_guess target_dir subdir
filename="$(basename "$zip_path")"
if [[ "$filename" =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then
version_guess="${BASH_REMATCH[1]}"
else
version_guess="$VERSION"
fi
target_dir="$staging_dir"
if [[ -n "$subdir_template" ]]; then
subdir="$subdir_template"
subdir="${subdir//\{\{VERSION\}\}/$version_guess}"
subdir="${subdir//\{\{SHORT_VERSION\}\}/$version_guess}"
subdir="${subdir//\{\{TAG\}\}/v$version_guess}"
subdir="${subdir#/}"
subdir="${subdir%/}"
if [[ -n "$subdir" ]]; then
target_dir="$staging_dir/$subdir"
mkdir -p "$target_dir"
fi
fi
cp "$zip_path" "$target_dir/"
done
shopt -u nullglob
if [[ "$zip_found" != true ]]; then
echo " Skipping Sparkle appcast generation (no ZIP archives found)."
rm -rf "$staging_dir"
return
fi
echo "🧾 Generating Sparkle appcast at $output"
if ! "$generator" \
--download-url-prefix "$download_prefix" \