From b7693b606e346b13569ab7e9654a5f137b70d070 Mon Sep 17 00:00:00 2001 From: Karol Labus Date: Thu, 17 Sep 2026 21:09:12 +0200 Subject: [PATCH] fix: replace release assets cleanly in Gitea Action --- .gitea/workflows/release.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index ee69d70..44e506b 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -70,14 +70,22 @@ jobs: REL_ID=$(echo "$RELEASE_RES" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2) fi + # Delete existing assets for this release if present + ASSETS=$(curl -s -H "Authorization: token $TOKEN" "$API_URL/repos/$REPO/releases/$REL_ID/assets") + echo "$ASSETS" | grep -o '"id":[0-9]*' | cut -d':' -f2 | while read -r asset_id; do + if [ -n "$asset_id" ]; then + curl -s -X DELETE -H "Authorization: token $TOKEN" "$API_URL/repos/$REPO/releases/$REL_ID/assets/$asset_id" + fi + done + # Upload Assets curl -s -X POST "$API_URL/repos/$REPO/releases/$REL_ID/assets" \ -H "Authorization: token $TOKEN" \ - -F "attachment=@BlackBarRemover_${TAG}_jf10.11.zip" || true + -F "attachment=@BlackBarRemover_${TAG}_jf10.11.zip" curl -s -X POST "$API_URL/repos/$REPO/releases/$REL_ID/assets" \ -H "Authorization: token $TOKEN" \ - -F "attachment=@BlackBarRemover_${TAG}_jf12.0.zip" || true + -F "attachment=@BlackBarRemover_${TAG}_jf12.0.zip" - name: Update manifest.json run: |