more Sparkle tests

This commit is contained in:
Micha
2025-11-25 18:11:47 +01:00
parent 3f849d0db6
commit 02828c8d5b
4 changed files with 30 additions and 7 deletions

View File

@@ -63,11 +63,28 @@ if [[ -z "$release_id" || "$release_id" == "null" ]]; then
exit 1
fi
delete_existing_asset() {
local filename="$1"
local asset_id
asset_id="$(curl -sS \
-H "Authorization: token ${GITEA_TOKEN}" \
"${API_URL}/releases/${release_id}/assets" | jq -r --arg name "$filename" '.[] | select(.name == $name) | .id' | head -n 1)"
if [[ -n "$asset_id" && "$asset_id" != "null" ]]; then
echo "🗑️ Removing existing asset ${filename}"
curl -sS \
-H "Authorization: token ${GITEA_TOKEN}" \
-X DELETE \
"${API_URL}/releases/${release_id}/assets/${asset_id}" >/dev/null
fi
}
upload_asset() {
local file="$1"
local filename
filename="$(basename "$file")"
delete_existing_asset "$filename"
echo "⬆️ Uploading ${filename}"
curl -sS \
-H "Authorization: token ${GITEA_TOKEN}" \
@@ -78,8 +95,4 @@ upload_asset() {
upload_asset "$ZIP_PATH"
upload_asset "$DMG_PATH"
if [[ -n "${SPARKLE_APPCAST_OUTPUT:-}" && -f "${SPARKLE_APPCAST_OUTPUT}" ]]; then
upload_asset "$SPARKLE_APPCAST_OUTPUT"
fi
echo "🎉 Release ${RELEASE_TAG} assets uploaded."