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.
This commit is contained in:
@@ -98,6 +98,9 @@ jobs:
|
|||||||
print(json.dumps('\n\n'.join(sections)))
|
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" \
|
RELEASE=$(curl -s -X POST "$BASE_URL/releases" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
@@ -105,7 +108,7 @@ jobs:
|
|||||||
\"tag_name\": \"$TAG\",
|
\"tag_name\": \"$TAG\",
|
||||||
\"name\": \"LedGrab $TAG\",
|
\"name\": \"LedGrab $TAG\",
|
||||||
\"body\": $BODY_JSON,
|
\"body\": $BODY_JSON,
|
||||||
\"draft\": false,
|
\"draft\": true,
|
||||||
\"prerelease\": $IS_PRE
|
\"prerelease\": $IS_PRE
|
||||||
}")
|
}")
|
||||||
|
|
||||||
@@ -350,3 +353,25 @@ jobs:
|
|||||||
if ! echo "$TAG" | grep -qE '(alpha|beta|rc)'; then
|
if ! echo "$TAG" | grep -qE '(alpha|beta|rc)'; then
|
||||||
docker push "$REGISTRY:latest"
|
docker push "$REGISTRY:latest"
|
||||||
fi
|
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"
|
||||||
|
|||||||
Reference in New Issue
Block a user