more Sparkle tests

This commit is contained in:
Micha
2025-11-26 18:35:05 +01:00
parent c2cd66d2a3
commit 0d013e64f7
3 changed files with 12 additions and 40 deletions

View File

@@ -29,51 +29,25 @@ find_generate_appcast() {
generate_appcast() {
local generator
generator="$(find_generate_appcast)"
local download_prefix="${SPARKLE_DOWNLOAD_BASE_URL:-}"
local subdir_template="${SPARKLE_DOWNLOAD_SUBDIR_TEMPLATE:-}"
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
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)"
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
cp "$ARTIFACTS_DIR"/*.zip "$staging_dir"/ 2>/dev/null || true
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
if ! ls "$staging_dir"/*.zip >/dev/null 2>&1; then
echo " Skipping Sparkle appcast generation (no ZIP archives found)."
rm -rf "$staging_dir"
return