Skip to content

Commit 7919d6d

Browse files
committed
chore: only create draft release once, before all jobs start
1 parent f8b3934 commit 7919d6d

File tree

1 file changed

+22
-35
lines changed

1 file changed

+22
-35
lines changed

.github/workflows/build-binaries.yml

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,27 @@ jobs:
3131
runs-on: ubuntu-latest
3232
env:
3333
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
outputs:
35+
version_tag: ${{ steps.get_version.outputs.VERSION_TAG }}
3436
steps:
37+
- name: Checkout git repo
38+
# only run this on "push" to "master" or alpha releases
39+
uses: actions/checkout@v4
40+
# We only need a few files in this run, no point cloning everything
41+
with:
42+
sparse-checkout: |
43+
package.json
44+
build/release-notes.md
45+
build/release-notes-alpha.md
46+
sparse-checkout-cone-mode: false
47+
3548
- name: Get version tag from package.json
3649
id: get_version
37-
# only run this on "push" to "master" or alpha releases
38-
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
3950
run: |
4051
version=$(node -p "require('./package.json').version")
4152
echo "VERSION_TAG=$version" >> "$GITHUB_OUTPUT"
42-
- name: Upload changes to draft release
53+
54+
- name: Create draft release
4355
# only run this on "push" to "master" or alpha releases
4456
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
4557
uses: ncipollo/release-action@v1
@@ -49,10 +61,6 @@ jobs:
4961
draft: true
5062
bodyFile: ${{ env.SHOULD_PUBLISH_ALPHA == 'true' && 'build/release-notes-alpha.md' || 'build/release-notes.md' }}
5163
allowUpdates: true
52-
omitNameDuringUpdate: true
53-
omitBodyDuringUpdate: true
54-
replacesArtifacts: true
55-
updateOnlyUnreleased: true
5664

5765
build_linux:
5866
runs-on: ubuntu-22.04
@@ -139,18 +147,8 @@ jobs:
139147
sparse-checkout: |
140148
package.json
141149
build/setup-release-combine.sh
142-
build/release-notes.md
143-
build/release-notes-alpha.md
144150
sparse-checkout-cone-mode: false
145151

146-
- name: Get version tag from package.json
147-
id: get_version
148-
# only run this on "push" to "master" or alpha releases
149-
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
150-
run: |
151-
version=$(node -p "require('./package.json').version")
152-
echo "VERSION_TAG=$version" >> "$GITHUB_OUTPUT"
153-
154152
- name: Download release metadata
155153
# only run this on "push" to "master" or alpha releases
156154
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
@@ -171,10 +169,7 @@ jobs:
171169
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
172170
uses: ncipollo/release-action@v1
173171
with:
174-
tag: v${{ steps.get_version.outputs.VERSION_TAG }}
175-
name: 'Session ${{ steps.get_version.outputs.VERSION_TAG }}'
176-
draft: true
177-
bodyFile: ${{ env.SHOULD_PUBLISH_ALPHA == 'true' && 'build/release-notes-alpha.md' || 'build/release-notes.md' }}
172+
tag: v${{ needs.create_draft_release.outputs.version_tag }}
178173
artifacts: 'dist/latest-linux.yml'
179174
allowUpdates: true
180175
omitNameDuringUpdate: true
@@ -286,24 +281,19 @@ jobs:
286281
post_build_mac:
287282
needs: [build_mac_arm64, build_mac_x64]
288283
runs-on: ubuntu-22.04
284+
env:
285+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
289286
steps:
290287
- name: Checkout git repo
291288
# only run this on "push" to "master" or alpha releases
292289
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
293290
uses: actions/checkout@v4
294-
# We only need the package.json file in this run (to extract the version being built)
291+
# We only need a few files in this run, no point cloning everything
295292
with:
296293
sparse-checkout: |
297294
package.json
298295
build/setup-release-combine.sh
299-
300-
- name: Get version tag from package.json
301-
id: get_version
302-
# only run this on "push" to "master" or alpha releases
303-
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
304-
run: |
305-
version=$(node -p "require('./package.json').version")
306-
echo "VERSION_TAG=$version" >> "$GITHUB_OUTPUT"
296+
sparse-checkout-cone-mode: false
307297

308298
- name: Download release metadata
309299
# only run this on "push" to "master" or alpha releases
@@ -325,13 +315,10 @@ jobs:
325315
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
326316
uses: ncipollo/release-action@v1
327317
with:
328-
tag: v${{ steps.get_version.outputs.VERSION_TAG }}
329-
name: 'Session ${{ steps.get_version.outputs.VERSION_TAG }}'
330-
draft: true
331-
bodyFile: ${{ env.SHOULD_PUBLISH_ALPHA == 'true' && 'build/release-notes-alpha.md' || 'build/release-notes.md' }}
318+
tag: v${{ needs.create_draft_release.outputs.version_tag }}
332319
artifacts: 'dist/latest-mac.yml'
333320
allowUpdates: true
334-
omitBodyDuringUpdate: true
335321
omitNameDuringUpdate: true
322+
omitBodyDuringUpdate: true
336323
replacesArtifacts: true
337324
updateOnlyUnreleased: true

0 commit comments

Comments
 (0)