Skip to content

Commit cb57392

Browse files
committed
Merge remote-tracking branch 'upstream/master' into dev
2 parents 4857657 + 866026f commit cb57392

File tree

1 file changed

+35
-10
lines changed

1 file changed

+35
-10
lines changed

.github/workflows/build-binaries.yml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ on:
1616
- dev
1717
- 'release/**'
1818
- 'ci/**'
19+
workflow_dispatch:
20+
inputs:
21+
target_branch:
22+
description: 'Branch to make a release of'
23+
required: true
24+
default: 'dev'
25+
26+
# Dynamic name for the run
27+
run-name: >
28+
Session Desktop ${{ github.event_name == 'workflow_dispatch' && format('(manual run on {0})', github.event.inputs.target_branch) || format('(push)', github.event.pull_request.number || github.ref) }}
1929
2030
concurrency:
2131
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -27,15 +37,14 @@ env:
2737
SHOULD_PUBLISH_ALPHA: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') && contains(github.ref, '-alpha.') }}
2838

2939
jobs:
30-
create_draft_release:
40+
create_draft_release_if_needed:
3141
runs-on: ubuntu-latest
3242
env:
3343
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3444
outputs:
3545
version_tag: ${{ steps.get_version.outputs.VERSION_TAG }}
3646
steps:
3747
- name: Checkout git repo
38-
# only run this on "push" to "master" or alpha releases
3948
uses: actions/checkout@v4
4049
# We only need a few files in this run, no point cloning everything
4150
with:
@@ -44,6 +53,7 @@ jobs:
4453
build/release-notes.md
4554
build/release-notes-alpha.md
4655
sparse-checkout-cone-mode: false
56+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
4757

4858
- name: Get version tag from package.json
4959
id: get_version
@@ -61,10 +71,15 @@ jobs:
6171
draft: true
6272
bodyFile: ${{ env.SHOULD_PUBLISH_ALPHA == 'true' && 'build/release-notes-alpha.md' || 'build/release-notes.md' }}
6373
allowUpdates: true
74+
skipIfReleaseExists: true
75+
omitBodyDuringUpdate: true
76+
omitDraftDuringUpdate: true
77+
omitNameDuringUpdate: true
78+
omitPrereleaseDuringUpdate: true
6479

6580
build_linux:
6681
runs-on: ubuntu-22.04
67-
needs: [create_draft_release]
82+
needs: [create_draft_release_if_needed]
6883
strategy:
6984
fail-fast: false
7085
matrix:
@@ -78,6 +93,8 @@ jobs:
7893

7994
- name: Checkout git repo
8095
uses: actions/checkout@v4
96+
with:
97+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
8198

8299
- name: Setup & Build
83100
uses: ./actions/setup_and_build
@@ -133,7 +150,7 @@ jobs:
133150
path: dist/latest-linux-${{ matrix.pkg_to_build }}-${{ github.sha }}.yml
134151

135152
post_build_linux:
136-
needs: [build_linux]
153+
needs: [create_draft_release_if_needed, build_linux]
137154
runs-on: ubuntu-22.04
138155
env:
139156
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -148,6 +165,7 @@ jobs:
148165
package.json
149166
build/setup-release-combine.sh
150167
sparse-checkout-cone-mode: false
168+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
151169

152170
- name: Download release metadata
153171
# only run this on "push" to "master" or alpha releases
@@ -169,7 +187,7 @@ jobs:
169187
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
170188
uses: ncipollo/release-action@v1
171189
with:
172-
tag: v${{ needs.create_draft_release.outputs.version_tag }}
190+
tag: v${{ needs.create_draft_release_if_needed.outputs.version_tag }}
173191
artifacts: 'dist/latest-linux.yml'
174192
allowUpdates: true
175193
omitNameDuringUpdate: true
@@ -179,14 +197,16 @@ jobs:
179197

180198
build_windows:
181199
runs-on: windows-2022
182-
needs: [create_draft_release]
200+
needs: [create_draft_release_if_needed]
183201
env:
184202
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185203
steps:
186204
- run: git config --global core.autocrlf false
187205

188206
- name: Checkout git repo
189207
uses: actions/checkout@v4
208+
with:
209+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
190210

191211
- name: Setup & Build
192212
uses: ./actions/setup_and_build
@@ -217,7 +237,7 @@ jobs:
217237
# We want both arm64 and intel mac builds, and according to this https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources macos-14 and above is always arm64 and macos-13 is the last intel runner
218238
# NOTE x64 builds made on an arm64 host will not bundle the native modules correctly https://github.com/electron-userland/electron-builder/issues/8646
219239
build_mac_arm64:
220-
needs: [create_draft_release]
240+
needs: [create_draft_release_if_needed]
221241
runs-on: macos-14
222242
env:
223243
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -231,6 +251,8 @@ jobs:
231251

232252
- name: Checkout git repo
233253
uses: actions/checkout@v4
254+
with:
255+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
234256

235257
- name: Setup & Build
236258
uses: ./actions/setup_and_build
@@ -249,7 +271,7 @@ jobs:
249271

250272
build_mac_x64:
251273
runs-on: macos-13
252-
needs: [create_draft_release]
274+
needs: [create_draft_release_if_needed]
253275
env:
254276
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
255277
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
@@ -262,6 +284,8 @@ jobs:
262284

263285
- name: Checkout git repo
264286
uses: actions/checkout@v4
287+
with:
288+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
265289

266290
- name: Setup & Build
267291
uses: ./actions/setup_and_build
@@ -279,7 +303,7 @@ jobs:
279303
should_publish: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
280304

281305
post_build_mac:
282-
needs: [build_mac_arm64, build_mac_x64]
306+
needs: [create_draft_release_if_needed, build_mac_arm64, build_mac_x64]
283307
runs-on: ubuntu-22.04
284308
env:
285309
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -294,6 +318,7 @@ jobs:
294318
package.json
295319
build/setup-release-combine.sh
296320
sparse-checkout-cone-mode: false
321+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
297322

298323
- name: Download release metadata
299324
# only run this on "push" to "master" or alpha releases
@@ -315,7 +340,7 @@ jobs:
315340
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
316341
uses: ncipollo/release-action@v1
317342
with:
318-
tag: v${{ needs.create_draft_release.outputs.version_tag }}
343+
tag: v${{ needs.create_draft_release_if_needed.outputs.version_tag }}
319344
artifacts: 'dist/latest-mac.yml'
320345
allowUpdates: true
321346
omitNameDuringUpdate: true

0 commit comments

Comments
 (0)