From c221371fb15b0d4670147267e76525bb99259af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= <44814898+BruebachL@users.noreply.github.com> Date: Sat, 7 Nov 2026 22:29:11 +0100 Subject: [PATCH] [CI] Fill in empty draft releases without touching published ones The existence check skipped release creation for any existing release, which left a draft saved from the GitHub UI empty and silently reused a published release. Inspect the release instead: create it when missing, fill in the title, notes and prerelease flag of an empty draft, and leave a draft that already has a body or a published release untouched. --- .github/workflows/desktop-build.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index ad0cfd82b..3dcaf8d5a 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -73,7 +73,7 @@ jobs: TAG: ${{ steps.configure.outputs.tag }} run: .ci/prep_release.sh - - name: "Create release" + - name: "Create or update draft release" if: steps.configure.outputs.tag != null id: create_release shell: bash @@ -85,9 +85,15 @@ jobs: body_path: ${{ steps.prepare.outputs.body_path }} prerelease: ${{ steps.prepare.outputs.is_beta }} run: | - if gh release view "$tag_name" >/dev/null 2>&1; then - echo "::warning::Release $tag_name already exists" - else + # A release for this tag may already exist: a maintainer can save a draft in + # the GitHub UI before pushing the tag, or an earlier run may have left one. + # Never touch a published release, and never overwrite a draft that already + # has a body (generated notes or a maintainer's edits) - only fill in an + # empty draft. Prints " "; empty when there is none. + release_state="$(gh release view "$tag_name" --json isDraft,body \ + --template '{{.isDraft}} {{len (or .body "")}}' 2>/dev/null || true)" + + if [[ -z "$release_state" ]]; then args=() [[ $prerelease == yes ]] && args+=(--prerelease) @@ -95,6 +101,18 @@ jobs: --target "$target" \ --title "$release_name" \ --notes-file "$body_path" + elif [[ "$release_state" == "true 0" ]]; then + echo "Filling in the empty draft release $tag_name" + args=(--prerelease=false) + [[ $prerelease == yes ]] && args=(--prerelease) + + gh release edit "$tag_name" "${args[@]}" \ + --title "$release_name" \ + --notes-file "$body_path" + elif [[ "$release_state" == true* ]]; then + echo "::warning::Draft release $tag_name already has a body, leaving it untouched" + else + echo "::warning::Release $tag_name is already published, leaving it untouched" fi build-linux: