diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 3ac5a57..6f8770f 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -175,6 +175,18 @@ jobs: rid=$(echo "$release_json" | jq -r .id) echo "Release id: $rid" + # Wipe any pre-existing assets so a re-run (e.g. after a tag + # rotation) produces a clean asset list rather than duplicates + # accumulating across runs. + existing=$(curl -fsSL "$api/repos/$REPO/releases/$rid/assets" \ + -H "Authorization: token $GITEA_TOKEN") + for aid in $(echo "$existing" | jq -r '.[].id'); do + echo " deleting old asset $aid" + curl -fsSL -X DELETE \ + "$api/repos/$REPO/releases/$rid/assets/$aid" \ + -H "Authorization: token $GITEA_TOKEN" + done + upload() { local f="$1" echo " uploading $f"