Skip to content

Commit 524fca6

Browse files
committed
Fix multi-platform release race: build-then-publish-once instead of parallel publish
1 parent 959af3a commit 524fca6

1 file changed

Lines changed: 39 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,50 @@ jobs:
3737
npm --prefix frontend test
3838
npm --prefix app test
3939
40-
- name: Build and publish
40+
# Build only — no publish here. Three parallel jobs each trying to
41+
# create/find the same GitHub release is a known electron-builder race:
42+
# only one reliably wins, and the others can exit 0 while silently
43+
# skipping their own upload. Publishing happens once, sequentially,
44+
# in the job below instead.
45+
- name: Build
4146
working-directory: app
42-
run: npm run build:all && npx electron-builder --publish always
43-
env:
44-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: npm run build:all && npx electron-builder --publish never
48+
49+
- name: Upload build artifacts
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: dist-${{ matrix.os }}
53+
path: |
54+
app/release/*.exe
55+
app/release/*.exe.blockmap
56+
app/release/*.dmg
57+
app/release/*.dmg.blockmap
58+
app/release/*.zip
59+
app/release/*.AppImage
60+
app/release/*.yml
61+
if-no-files-found: ignore
4562

4663
publish-release:
4764
needs: build
4865
runs-on: ubuntu-latest
4966
steps:
50-
# electron-builder always creates the GitHub release as a draft (its
51-
# config schema doesn't accept "draft: false" as of this app's last
52-
# update) — un-draft it here once every platform has finished
53-
# uploading, so the tag doesn't need a manual "Publish release" click.
54-
- name: Publish the release
67+
- uses: actions/download-artifact@v4
68+
with:
69+
path: dist
70+
merge-multiple: true
71+
72+
- name: List downloaded assets
73+
run: ls -la dist
74+
75+
- name: Publish release with all platform assets
5576
env:
5677
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57-
run: gh release edit "${{ github.ref_name }}" --repo "${{ github.repository }}" --draft=false
78+
run: |
79+
gh release create "${{ github.ref_name }}" dist/* \
80+
--repo "${{ github.repository }}" \
81+
--title "${{ github.ref_name }}" \
82+
--generate-notes \
83+
--draft=false \
84+
|| gh release upload "${{ github.ref_name }}" dist/* \
85+
--repo "${{ github.repository }}" \
86+
--clobber

0 commit comments

Comments
 (0)