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"