diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 689dd5ce..3befc59b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -87,14 +87,16 @@ jobs: ASSET=$(ls dist/Mopidy_*.tar.gz dist/Mopidy-*.tar.gz 2>/dev/null | head -1) API="http://gitea.service:3000/api/v1/repos/secstate/Iris" - # Delete old continuous tag/release if exists + # Delete old release first (by tag lookup), then delete the tag + OLD_ID=$(curl -sf "${API}/releases/tags/continuous" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + | python3 -c "import sys,json;print(json.load(sys.stdin).get('id',''))" 2>/dev/null) + if [ -n "$OLD_ID" ]; then + curl -sf -X DELETE "${API}/releases/${OLD_ID}" \ + -H "Authorization: token ${GITEA_TOKEN}" || true + fi curl -sf -X DELETE "${API}/tags/continuous" \ -H "Authorization: token ${GITEA_TOKEN}" || true - curl -sf "${API}/releases/tags/continuous" \ - -H "Authorization: token ${GITEA_TOKEN}" \ - | python3 -c "import sys,json;print(json.load(sys.stdin).get('id',''))" 2>/dev/null \ - | xargs -I{} curl -sf -X DELETE "${API}/releases/{}" \ - -H "Authorization: token ${GITEA_TOKEN}" || true # Create release and upload asset RELEASE_ID=$(curl -sf -X POST "${API}/releases" \