From 416c8b07d2d4fe78c26bb2d908b9608f5bfb8347 Mon Sep 17 00:00:00 2001 From: Giancarmine Salucci Date: Mon, 25 May 2026 21:01:09 +0200 Subject: [PATCH] ci: remove broken concurrency block, make release step idempotent - Removed concurrency/cancel-in-progress: on this Gitea runner version cancelled runs get re-queued causing an infinite restart loop - Release creation now checks for existing tag first (GET releases/tags/TAG) and reuses the existing release ID if found, preventing the second duplicate run from failing with a 409/422 tag-already-exists error --- .gitea/workflows/android-build.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/android-build.yml b/.gitea/workflows/android-build.yml index dbe0295..1ab38e4 100644 --- a/.gitea/workflows/android-build.yml +++ b/.gitea/workflows/android-build.yml @@ -4,12 +4,6 @@ on: push: workflow_dispatch: -# Only one run per branch at a time. A new push cancels any in-progress run, -# preventing duplicate builds when the runner picks up the same event twice. -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - permissions: contents: write # required for creating releases packages: write @@ -186,13 +180,20 @@ jobs: MD_LIST=$(echo "$COMMIT_LOG" | sed 's/^/- /') BODY=$(printf '%s' "$MD_LIST" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))") - # ── Create the release ─────────────────────────────────────────────── - RESP=$(curl -sf -X POST "$API/releases" \ - -H "Authorization: token $TOKEN" \ - -H "Content-Type: application/json" \ - -d "{\"tag_name\":\"$TAG\",\"name\":\"Build $VERSION\",\"body\":$BODY,\"draft\":false,\"prerelease\":false}") - RELEASE_ID=$(echo "$RESP" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") - echo "Created release $TAG (id=$RELEASE_ID)" + # ── Create release (idempotent: reuse existing tag if already present) ─── + EXISTING=$(curl -sf "$API/releases/tags/$TAG" \ + -H "Authorization: token $TOKEN" || true) + if [[ -n "$EXISTING" ]]; then + RELEASE_ID=$(echo "$EXISTING" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") + echo "Release $TAG already exists (id=$RELEASE_ID) — reusing." + else + RESP=$(curl -sf -X POST "$API/releases" \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"$TAG\",\"name\":\"Build $VERSION\",\"body\":$BODY,\"draft\":false,\"prerelease\":false}") + RELEASE_ID=$(echo "$RESP" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") + echo "Created release $TAG (id=$RELEASE_ID)" + fi # ── Upload APKs as release assets ──────────────────────────────────── upload_asset() {