From 8e3fd053d81d7cfd5f38221d828ac59242430f17 Mon Sep 17 00:00:00 2001 From: pc-heini Date: Mon, 15 Jun 2026 12:33:27 +0200 Subject: [PATCH] CI: make the tag step idempotent on force rebuilds Force-rebuilding an already-published version made the final tag push fail ("tag already exists"), turning an otherwise successful run red. Skip tagging when the tag already exists on the remote. Co-Authored-By: Claude Opus 4.8 --- .gitea/workflows/build-flatpak.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build-flatpak.yml b/.gitea/workflows/build-flatpak.yml index 3f55e0b8b..1227caa63 100644 --- a/.gitea/workflows/build-flatpak.yml +++ b/.gitea/workflows/build-flatpak.yml @@ -142,5 +142,10 @@ jobs: TOKEN: ${{ secrets.PUBLISH_TOKEN != '' && secrets.PUBLISH_TOKEN || secrets.GITHUB_TOKEN }} run: | AUTH_URL="$(echo "${{ github.server_url }}" | sed "s#://#://${{ github.actor }}:${TOKEN}@#")/${{ github.repository }}.git" - git tag "v${{ steps.ver.outputs.version }}" - git push "$AUTH_URL" "v${{ steps.ver.outputs.version }}" + TAG="v${{ steps.ver.outputs.version }}" + if git ls-remote --tags "$AUTH_URL" "refs/tags/$TAG" | grep -q .; then + echo "Tag $TAG already exists (force rebuild) - leaving it in place." + else + git tag "$TAG" + git push "$AUTH_URL" "$TAG" + fi