From da5ded48abfaed962c74126541c81f08c103bd21 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Fri, 11 Sep 2026 22:28:39 +0200 Subject: [PATCH] fix(ci): the release step tolerates a release that already exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A re-fired tag hits the release POST with a 409 and curl -sf turns "already exists" into a red job while the image jobs succeed — observed on boilerroom's v0.1.0 re-fires tonight; this workflow fails the same way. Check-then-create makes the step idempotent. Co-Authored-By: Claude Fable 5 --- .gitea/workflows/build.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index f964e4a..d0113a5 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -10,12 +10,20 @@ jobs: runs-on: ubuntu-latest steps: - name: Create Gitea Release + # Idempotent: a re-fired tag finds its release already present and + # says so instead of failing on the 409. run: | + api="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" + auth='Authorization: token ${{ secrets.GITHUB_TOKEN }}' + if curl -sf -H "$auth" "$api/tags/${{ github.ref_name }}" > /dev/null; then + echo "release for ${{ github.ref_name }} already exists — nothing to do" + exit 0 + fi curl -sf -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "$auth" \ -H "Content-Type: application/json" \ -d '{"tag_name": "${{ github.ref_name }}", "name": "Release ${{ github.ref_name }}", "body": "Automated release for ${{ github.ref_name }}"}' \ - "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" + "$api" build: runs-on: ubuntu-latest