From 10a38a1f85c4b324c347ccd508c0ce24ac89e2f6 Mon Sep 17 00:00:00 2001 From: cinco euzebio Date: Sun, 1 Mar 2026 03:34:27 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20ci:=20delete=20existing=20releas?= =?UTF-8?q?e=20before=20recreating=20on=20retag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a tag is deleted and recreated, the CI tried to POST a new release that already existed, getting 409 and leaving RELEASE_ID null, which caused asset uploads to fail with 405. Now checks for an existing release by tag and deletes it before creating a new one. --- .drone.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.drone.yml b/.drone.yml index 3caf1b4..8c1cb80 100644 --- a/.drone.yml +++ b/.drone.yml @@ -76,6 +76,16 @@ steps: commands: - apk add --no-cache curl jq - | + # Delete existing release for this tag if present (handles retag scenarios) + EXISTING_ID=$(curl -fsSL \ + -H "Authorization: token $GITEA_TOKEN" \ + "https://git.cincoeuzebio.com/api/v1/repos/cinco/Tmuxido/releases/tags/$DRONE_TAG" \ + | jq -r '.id // empty') + if [ -n "$EXISTING_ID" ]; then + curl -fsSL -X DELETE \ + -H "Authorization: token $GITEA_TOKEN" \ + "https://git.cincoeuzebio.com/api/v1/repos/cinco/Tmuxido/releases/$EXISTING_ID" + fi # Read DRONE_TAG via ENVIRON inside awk to avoid Drone's ${VAR} substitution # which would replace ${TAG} with an empty string before the shell runs. BODY=$(awk '