16
16
- dev
17
17
- ' release/**'
18
18
- ' 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) }}
19
29
20
30
concurrency :
21
31
group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
27
37
SHOULD_PUBLISH_ALPHA : ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') && contains(github.ref, '-alpha.') }}
28
38
29
39
jobs :
30
- create_draft_release :
40
+ create_draft_release_if_needed :
31
41
runs-on : ubuntu-latest
32
42
env :
33
43
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34
44
outputs :
35
45
version_tag : ${{ steps.get_version.outputs.VERSION_TAG }}
36
46
steps :
37
47
- name : Checkout git repo
38
- # only run this on "push" to "master" or alpha releases
39
48
uses : actions/checkout@v4
40
49
# We only need a few files in this run, no point cloning everything
41
50
with :
44
53
build/release-notes.md
45
54
build/release-notes-alpha.md
46
55
sparse-checkout-cone-mode : false
56
+ ref : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
47
57
48
58
- name : Get version tag from package.json
49
59
id : get_version
@@ -61,10 +71,15 @@ jobs:
61
71
draft : true
62
72
bodyFile : ${{ env.SHOULD_PUBLISH_ALPHA == 'true' && 'build/release-notes-alpha.md' || 'build/release-notes.md' }}
63
73
allowUpdates : true
74
+ skipIfReleaseExists : true
75
+ omitBodyDuringUpdate : true
76
+ omitDraftDuringUpdate : true
77
+ omitNameDuringUpdate : true
78
+ omitPrereleaseDuringUpdate : true
64
79
65
80
build_linux :
66
81
runs-on : ubuntu-22.04
67
- needs : [create_draft_release ]
82
+ needs : [create_draft_release_if_needed ]
68
83
strategy :
69
84
fail-fast : false
70
85
matrix :
78
93
79
94
- name : Checkout git repo
80
95
uses : actions/checkout@v4
96
+ with :
97
+ ref : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
81
98
82
99
- name : Setup & Build
83
100
uses : ./actions/setup_and_build
@@ -133,7 +150,7 @@ jobs:
133
150
path : dist/latest-linux-${{ matrix.pkg_to_build }}-${{ github.sha }}.yml
134
151
135
152
post_build_linux :
136
- needs : [build_linux]
153
+ needs : [create_draft_release_if_needed, build_linux]
137
154
runs-on : ubuntu-22.04
138
155
env :
139
156
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -148,6 +165,7 @@ jobs:
148
165
package.json
149
166
build/setup-release-combine.sh
150
167
sparse-checkout-cone-mode : false
168
+ ref : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
151
169
152
170
- name : Download release metadata
153
171
# only run this on "push" to "master" or alpha releases
@@ -169,7 +187,7 @@ jobs:
169
187
if : ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
170
188
uses : ncipollo/release-action@v1
171
189
with :
172
- tag : v${{ needs.create_draft_release .outputs.version_tag }}
190
+ tag : v${{ needs.create_draft_release_if_needed .outputs.version_tag }}
173
191
artifacts : ' dist/latest-linux.yml'
174
192
allowUpdates : true
175
193
omitNameDuringUpdate : true
@@ -179,14 +197,16 @@ jobs:
179
197
180
198
build_windows :
181
199
runs-on : windows-2022
182
- needs : [create_draft_release ]
200
+ needs : [create_draft_release_if_needed ]
183
201
env :
184
202
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
185
203
steps :
186
204
- run : git config --global core.autocrlf false
187
205
188
206
- name : Checkout git repo
189
207
uses : actions/checkout@v4
208
+ with :
209
+ ref : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
190
210
191
211
- name : Setup & Build
192
212
uses : ./actions/setup_and_build
@@ -217,7 +237,7 @@ jobs:
217
237
# 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
218
238
# NOTE x64 builds made on an arm64 host will not bundle the native modules correctly https://github.com/electron-userland/electron-builder/issues/8646
219
239
build_mac_arm64 :
220
- needs : [create_draft_release ]
240
+ needs : [create_draft_release_if_needed ]
221
241
runs-on : macos-14
222
242
env :
223
243
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -231,6 +251,8 @@ jobs:
231
251
232
252
- name : Checkout git repo
233
253
uses : actions/checkout@v4
254
+ with :
255
+ ref : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
234
256
235
257
- name : Setup & Build
236
258
uses : ./actions/setup_and_build
@@ -249,7 +271,7 @@ jobs:
249
271
250
272
build_mac_x64 :
251
273
runs-on : macos-13
252
- needs : [create_draft_release ]
274
+ needs : [create_draft_release_if_needed ]
253
275
env :
254
276
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
255
277
MAC_CERTIFICATE : ${{ secrets.MAC_CERTIFICATE }}
@@ -262,6 +284,8 @@ jobs:
262
284
263
285
- name : Checkout git repo
264
286
uses : actions/checkout@v4
287
+ with :
288
+ ref : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
265
289
266
290
- name : Setup & Build
267
291
uses : ./actions/setup_and_build
@@ -279,7 +303,7 @@ jobs:
279
303
should_publish : ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
280
304
281
305
post_build_mac :
282
- needs : [build_mac_arm64, build_mac_x64]
306
+ needs : [create_draft_release_if_needed, build_mac_arm64, build_mac_x64]
283
307
runs-on : ubuntu-22.04
284
308
env :
285
309
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -294,6 +318,7 @@ jobs:
294
318
package.json
295
319
build/setup-release-combine.sh
296
320
sparse-checkout-cone-mode : false
321
+ ref : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
297
322
298
323
- name : Download release metadata
299
324
# only run this on "push" to "master" or alpha releases
@@ -315,7 +340,7 @@ jobs:
315
340
if : ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
316
341
uses : ncipollo/release-action@v1
317
342
with :
318
- tag : v${{ needs.create_draft_release .outputs.version_tag }}
343
+ tag : v${{ needs.create_draft_release_if_needed .outputs.version_tag }}
319
344
artifacts : ' dist/latest-mac.yml'
320
345
allowUpdates : true
321
346
omitNameDuringUpdate : true
0 commit comments