Skip to content

Commit 8537ece

Browse files
yyq1025claude
andcommitted
ci: pre-create the draft release to fix electron-builder's create race
The GitHub publisher runs one instance per artifact; with no existing draft they raced to create one and v0.0.2 ended up as TWO drafts with the assets split between them (merged by hand afterwards). Creating the draft up front — commit-log notes included — gives every publisher instance the same release to find. The post-build notes step is gone; notes now ride on the create. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent d1aed3e commit 8537ece

1 file changed

Lines changed: 24 additions & 20 deletions

File tree

.github/workflows/release-menubar.yml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@ jobs:
6464
pnpm -r typecheck
6565
pnpm test
6666
67+
# Pre-create the draft release BEFORE electron-builder runs. Its GitHub
68+
# publisher spins up one instance per artifact; when no draft exists yet
69+
# they race to create one and the v0.0.2 run ended with TWO drafts and
70+
# the assets split between them. A pre-existing draft (matching tag +
71+
# version-named title) is found by every instance — no race. The body is
72+
# the commit log since the previous tag (direct-to-main workflow means
73+
# GitHub's PR-based auto-notes would be empty); hand-write a short
74+
# user-facing What's New above it before publishing.
75+
- name: Create draft release with commit-log notes
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
run: |
79+
TAG="$GITHUB_REF_NAME"
80+
PREV=$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || true)
81+
RANGE="${PREV:+$PREV..}$TAG"
82+
{
83+
echo "<!-- Add a short user-facing What's New above the commit list before publishing. -->"
84+
echo ""
85+
echo "## Commits${PREV:+ since $PREV}"
86+
echo ""
87+
git log --no-merges --pretty='- %s' "$RANGE"
88+
} > "$RUNNER_TEMP/notes.md"
89+
gh release create "$TAG" --draft --title "${TAG#v}" --notes-file "$RUNNER_TEMP/notes.md"
90+
6791
- name: Write App Store Connect API key
6892
env:
6993
APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }}
@@ -84,23 +108,3 @@ jobs:
84108
pnpm --filter '@sidecodeapp/menubar...' run build
85109
pnpm --filter @sidecodeapp/menubar exec electron-builder --mac --arm64 --publish always
86110
87-
# electron-builder creates the draft with an empty body; fill it with the
88-
# commit log since the previous tag. Direct-to-main workflow means GitHub's
89-
# PR-based auto-notes would be empty — the commit subjects ARE the
90-
# changelog here. Hand-write a short "What's new" above the list before
91-
# publishing.
92-
- name: Attach commit log to the draft release
93-
env:
94-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95-
run: |
96-
TAG="$GITHUB_REF_NAME"
97-
PREV=$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || true)
98-
RANGE="${PREV:+$PREV..}$TAG"
99-
{
100-
echo "<!-- Add a short user-facing What's New above the commit list before publishing. -->"
101-
echo ""
102-
echo "## Commits${PREV:+ since $PREV}"
103-
echo ""
104-
git log --no-merges --pretty='- %s' "$RANGE"
105-
} > "$RUNNER_TEMP/notes.md"
106-
gh release edit "$TAG" --draft=true --notes-file "$RUNNER_TEMP/notes.md"

0 commit comments

Comments
 (0)