From bc42604045f0f00838d4d4b3c21f03622c92229f Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Thu, 28 May 2026 17:26:28 +0300 Subject: [PATCH] ci(release): publish release only after every build job uploads assets create-release now creates the release as a draft so users never see a release page that's missing artifacts (or, worse, missing the sha256 sidecars that the in-app updater requires). A new publish-release job runs after create-release, build-windows, build-linux, and build-docker all succeed, and PATCHes the release to draft=false in one step. If any build fails, the draft stays hidden and can be deleted manually. --- .gitea/workflows/release.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index b2b32ea..28d295a 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -98,6 +98,9 @@ jobs: print(json.dumps('\n\n'.join(sections))) ") + # Created as draft so the release isn't user-visible until every + # build job has attached its assets. The publish-release job at + # the end of the workflow flips draft=false once all builds pass. RELEASE=$(curl -s -X POST "$BASE_URL/releases" \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ @@ -105,7 +108,7 @@ jobs: \"tag_name\": \"$TAG\", \"name\": \"LedGrab $TAG\", \"body\": $BODY_JSON, - \"draft\": false, + \"draft\": true, \"prerelease\": $IS_PRE }") @@ -350,3 +353,25 @@ jobs: if ! echo "$TAG" | grep -qE '(alpha|beta|rc)'; then docker push "$REGISTRY:latest" fi + + # ── Publish the release (flip draft=false) ───────────────── + # Runs only after every build job succeeded so users never see a + # release that's missing artifacts or sha256 sidecars (the in-app + # updater refuses to install without them). + publish-release: + needs: [create-release, build-windows, build-linux, build-docker] + if: github.event_name == 'push' && success() + runs-on: ubuntu-latest + steps: + - name: Promote draft release to published + env: + GITEA_TOKEN: ${{ secrets.DEPLOY_TOKEN }} + run: | + RELEASE_ID="${{ needs.create-release.outputs.release_id }}" + BASE_URL="${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}" + + curl -s -X PATCH "$BASE_URL/releases/$RELEASE_ID" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"draft": false}' + echo "Published release $RELEASE_ID"