Skip to content

Commit 3d72454

Browse files
committed
Refactor release workflow to improve draft handling and update documentation
1 parent bc9201d commit 3d72454

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ jobs:
2626
TAG_NAME: ${{ github.ref_name }}
2727
run: |
2828
set -euo pipefail
29-
release_json="$(gh api "repos/${GITHUB_REPOSITORY}/releases/tags/${TAG_NAME}" 2>/dev/null || true)"
30-
if [ -z "$release_json" ]; then
29+
if ! release_json="$(gh api "repos/${GITHUB_REPOSITORY}/releases/tags/${TAG_NAME}")"; then
3130
echo "No release for ${TAG_NAME}. electron-builder will create a draft."
3231
exit 0
3332
fi
@@ -37,12 +36,8 @@ jobs:
3736
echo "Release ${release_id} is already a draft."
3837
exit 0
3938
fi
40-
echo "Release ${release_id} is published. Converting it to a draft."
41-
if gh api -X PATCH "repos/${GITHUB_REPOSITORY}/releases/${release_id}" -f draft=true >/dev/null; then
42-
echo "Converted release ${release_id} to a draft."
43-
exit 0
44-
fi
45-
echo "Could not convert it. Deleting the published release (tag stays) so a draft can be created."
39+
echo "Release ${release_id} is already published (prerelease or latest). GitHub will not accept more files."
40+
echo "Deleting that release. The git tag stays. electron-builder will create a draft."
4641
gh api -X DELETE "repos/${GITHUB_REPOSITORY}/releases/${release_id}"
4742
4843
package:

docs/contributing.mdx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ Typecheck and build the renderer with `make web-build`. Package installers with
4343

4444
GitHub Actions packages macOS (universal DMG) and Windows (NSIS) when you add a version tag without a `v` prefix. That includes creating the tag in the GitHub UI, or pushing it from git.
4545

46-
1. Set the version you want in `web/package.json`, or let the workflow take it from the tag (`0.1.0`, `0.1.0-alpha.2`).
47-
2. Create only the git tag, not a published GitHub Release. In the GitHub tags page, or `git tag 0.1.0-alpha.5 && git push origin 0.1.0-alpha.5`.
48-
3. Wait for **Release desktop**. CI writes installers to a **draft** release. A published or prerelease tag is immutable, so the workflow converts that release to a draft first (or deletes it and recreates the draft).
49-
4. When both `Dagr_<version>.dmg` and `Dagr_<version>.exe` are attached, publish the draft. For an alpha tag, publish it as a prerelease.
46+
1. Set the version you want in `web/package.json`, or let the workflow take it from the tag (`0.1.0`, `0.1.0-alpha.7`).
47+
2. Create **only a git tag**. Do not use “Draft a new release” or publish a prerelease in the GitHub UI first.
48+
`git tag 0.1.0-alpha.7 && git push origin 0.1.0-alpha.7`
49+
3. Wait for **Release desktop**. CI creates a **draft** and attaches the installers.
50+
4. When both `Dagr_<version>.dmg` and `Dagr_<version>.exe` are on the draft, publish it. For an alpha, publish it as a prerelease.
51+
52+
If you already published a GitHub Release for that tag, CI deletes that release (the tag stays) and creates a draft so the files can be uploaded.
5053

5154
The download site and the in-app update checker only see the latest published, non-prerelease release. Builds are unsigned in this pass.
5255

0 commit comments

Comments
 (0)