Repository navigation
710 lines (702 loc) · 39.6 KB
/
Copy pathelectron-release.yml
File metadata and controls
710 lines (702 loc) · 39.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
name: Electron desktop release
# Builds are safe by default. Only an explicit publish dispatch exposes a release.
# Two channels, both cut from main: `vX.Y.Z` is Stable (GitHub's `latest`),
# `vX.Y.Z-beta.N` is Beta (a prerelease that never becomes `latest`). No other
# prerelease shape (-rc, -alpha, ...) is accepted.
#
# `rehearsal: true` runs the same build and verification from any branch
# without a tag: every package leg, the GGUF runtimes, the phone builds, the
# packaged smoke tests and prepare_electron_release.py against the version in
# package.json. It never publishes: no release or draft, no feed upload, no
# Docker or Android repository dispatch. Its artifacts stay on the run for a
# few days. tests/test_release_rehearsal.py pins these guards.
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
release_tag:
description: "Existing version tag to package using this workflow from main (optional)"
type: string
default: ''
publish:
description: "Publish the tagged Electron release after all platforms pass"
type: boolean
default: false
allow_unsigned:
description: "Explicitly accept unsigned/unnotarized Electron installers and documented updater limitations"
type: boolean
default: false
rehearsal:
description: "Rehearse the release from the selected branch: build and verify everything, publish nothing"
type: boolean
default: false
signpath_policy:
description: "Rehearsals only: submit Windows installers to this SignPath policy (none skips SignPath)"
type: choice
options: [none, test-signing]
default: none
permissions:
contents: read
concurrency:
group: electron-release-${{ inputs.rehearsal && format('rehearsal-{0}', github.ref_name) || inputs.release_tag || github.ref_name }}
cancel-in-progress: false
env:
# A rehearsal pins every leg to the dispatched commit, not the moving branch.
RELEASE_REF: ${{ inputs.release_tag && format('refs/tags/{0}', inputs.release_tag) || inputs.rehearsal && github.sha || github.ref }}
REHEARSAL: ${{ inputs.rehearsal == true }}
jobs:
validate:
# The archived sunset tag was assembled separately; future tags are Electron-only.
if: github.event_name == 'workflow_dispatch' || github.ref_name != vars.TAURI_SUNSET_TAG
runs-on: ubuntu-latest
outputs:
channel: ${{ steps.channel.outputs.channel }}
version: ${{ steps.channel.outputs.version }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ env.RELEASE_REF }}
- name: Require an exact version tag
if: inputs.rehearsal != true
env:
REF: ${{ env.RELEASE_REF }}
WORKFLOW_REF: ${{ github.ref }}
RELEASE_TAG_OVERRIDE: ${{ inputs.release_tag }}
ALLOW_UNSIGNED: ${{ inputs.allow_unsigned }}
DISPATCH_ACTOR: ${{ github.actor }}
RERUN_ACTOR: ${{ github.triggering_actor }}
OWNER: ${{ github.repository_owner }}
# Comma-separated logins the owner trusts with unsigned publishes. Only repo
# admins can edit Actions variables, so the owner stays in control of it.
UNSIGNED_PUBLISHERS: ${{ vars.UNSIGNED_RELEASE_PUBLISHERS }}
SIGNPATH_POLICY: ${{ inputs.signpath_policy }}
run: |
may_publish_unsigned() {
[ -n "$1" ] || return 1
[ "$1" = "$OWNER" ] && return 0
case ",$(printf '%s' "$UNSIGNED_PUBLISHERS" | tr -d '[:space:]')," in
*",$1,"*) return 0 ;;
esac
return 1
}
if [ "$ALLOW_UNSIGNED" = true ]; then
may_publish_unsigned "$DISPATCH_ACTOR" && may_publish_unsigned "$RERUN_ACTOR" || {
echo "Only the repository owner or an account in UNSIGNED_RELEASE_PUBLISHERS may accept unsigned installers"; exit 1;
}
fi
if [ -n "$RELEASE_TAG_OVERRIDE" ]; then
test "$WORKFLOW_REF" = refs/heads/main || { echo "Tag overrides require the workflow from main"; exit 1; }
fi
VERSION=$(node -p "require('./package.json').version")
test "$REF" = "refs/tags/v$VERSION" || { echo "Select the exact version tag"; exit 1; }
test "$(git rev-parse HEAD)" = "$(git rev-parse "$REF^{commit}")" || { echo "Checkout does not match the release tag"; exit 1; }
test "$SIGNPATH_POLICY" = none || test -z "$SIGNPATH_POLICY" || { echo "signpath_policy is for rehearsals; releases use the configured policy"; exit 1; }
- name: Validate the rehearsal request
if: inputs.rehearsal == true
env:
PUBLISH: ${{ inputs.publish }}
RELEASE_TAG_OVERRIDE: ${{ inputs.release_tag }}
ALLOW_UNSIGNED: ${{ inputs.allow_unsigned }}
run: |
# A rehearsal builds the dispatched commit and publishes nothing.
test "$PUBLISH" != true || { echo "A rehearsal never publishes; dispatch it without publish"; exit 1; }
test -z "$RELEASE_TAG_OVERRIDE" || { echo "A rehearsal builds the selected branch; leave release_tag empty"; exit 1; }
test "$ALLOW_UNSIGNED" != true || { echo "allow_unsigned only applies to publishing; a rehearsal reports signing as built"; exit 1; }
test "$(git rev-parse HEAD)" = "$GITHUB_SHA" || { echo "Checkout does not match the dispatched commit"; exit 1; }
- name: Resolve the release channel
id: channel
run: |
# stable (X.Y.Z) or beta (X.Y.Z-beta.N); any other shape fails here,
# for a rehearsal as for a tag.
echo "channel=$(python3 scripts/prepare_electron_release.py --print-channel)" >> "$GITHUB_OUTPUT"
echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
omnivoice-tts:
# The OmniVoice GGUF runtime each installer ships under resources/bin (#2780).
needs: validate
uses: ./.github/workflows/build-omnivoice-tts.yml
with:
ref: ${{ inputs.release_tag && format('refs/tags/{0}', inputs.release_tag) || inputs.rehearsal && github.sha || github.ref }}
desktop: true
retention_days: ${{ inputs.rehearsal && 3 || 0 }}
package:
needs: [validate, omnivoice-tts]
# actions: read is what SignPath's action documents for its github-token (it
# reads the job and downloads the uploaded unsigned artifact); nothing else
# beyond the top-level contents: read.
permissions:
contents: read
actions: read
runs-on: ${{ matrix.runner }}
# 75: three macOS build attempts when Apple drops a connection. A Windows leg
# with SignPath configured also waits for a manual approval (up to 70 minutes
# in the signing step). Job-level timeouts cannot read secrets or job env, so
# this keys on the organization variable, one of the settings that enable it.
timeout-minutes: ${{ matrix.platform == 'win32' && vars.SIGNPATH_ORGANIZATION_ID != '' && 150 || 75 }}
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
include:
# Jammy (glibc 2.35) so the native helper and its bundled libraries also run
# on the Snap base core22, which repackages this .deb (#3879).
- runner: ubuntu-22.04
platform: linux
arch: x64
target: x86_64-unknown-linux-gnu
flags: --linux --x64
gguf_platform: linux-x86_64
- runner: windows-2022
platform: win32
arch: x64
target: x86_64-pc-windows-msvc
flags: --win --x64
gguf_platform: windows-x86_64
- runner: windows-11-arm
platform: win32
arch: arm64
target: aarch64-pc-windows-msvc
flags: --win --arm64
# Windows on ARM runs the emulated x64 Python runtime, which
# spawns the x64 GGUF runtime.
gguf_platform: windows-x86_64
# Windows on ARM is new: a failed leg must not block the four
# established targets. check_electron_release_assets.py verifies the
# arm64 feed only when its manifest was published.
experimental: true
- runner: macos-15
platform: darwin
arch: arm64
target: aarch64-apple-darwin
flags: --mac --arm64
gguf_platform: darwin-arm64
- runner: macos-15-intel
platform: darwin
arch: x64
target: x86_64-apple-darwin
flags: --mac --x64
# No GGUF runtime: Intel Macs cannot run the local backend.
gguf_platform: ''
defaults:
run:
shell: bash
env:
VOICESTUDIO_RUST_TARGET: ${{ matrix.target }}
# packaging-contract.mjs requires this runtime in the installer.
VOICESTUDIO_OMNIVOICE_TTS_PLATFORM: ${{ matrix.gguf_platform }}
VOICESTUDIO_UPDATE_CHANNEL: electron-${{ needs.validate.outputs.channel }}-${{ matrix.platform }}-${{ matrix.arch }}
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
# SignPath (docs/code-signing-policy.md): active only when the API token
# secret and all three repository variables exist, and no own Windows
# certificate is configured. Otherwise nothing below runs and Windows
# signing behaves exactly as before. A rehearsal submits nothing unless
# it names a policy (signpath_policy=test-signing), and never the
# release policy.
SIGNPATH_ENABLED: ${{ matrix.platform == 'win32' && secrets.SIGNPATH_API_TOKEN != '' && vars.SIGNPATH_ORGANIZATION_ID != '' && vars.SIGNPATH_PROJECT_SLUG != '' && vars.SIGNPATH_SIGNING_POLICY_SLUG != '' && secrets.ELECTRON_WINDOWS_CSC_LINK == '' && (inputs.rehearsal != true || inputs.signpath_policy == 'test-signing') }}
SIGNPATH_POLICY: ${{ inputs.rehearsal == true && inputs.signpath_policy || vars.SIGNPATH_SIGNING_POLICY_SLUG }}
ARTIFACT_RETENTION_DAYS: ${{ inputs.rehearsal && 3 || 14 }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ env.RELEASE_REF }}
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '22'
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: '1.4.2'
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
workspaces: native/desktop-bridge -> target
key: electron-${{ matrix.target }}
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
with:
version: '0.12.13'
enable-cache: false
- name: Linux native dependencies
if: runner.os == 'Linux'
env:
GH_TOKEN: ${{ github.token }}
run: |
helper=.github/scripts/apt-retry.sh
# An older release tag predates the helper; take it from this workflow's commit.
if [ ! -f "$helper" ]; then
helper="$RUNNER_TEMP/apt-retry.sh"
gh api -H "Accept: application/vnd.github.raw" \
"repos/$GITHUB_REPOSITORY/contents/.github/scripts/apt-retry.sh?ref=$GITHUB_SHA" > "$helper"
fi
bash "$helper" install libasound2-dev libxdo-dev libxtst-dev libx11-dev libxkbcommon-dev libwayland-dev libssl-dev pkg-config xvfb zsync
- name: Bundle pinned uv for the host architecture
# The checkout is the release tag, which predates this helper when an older
# tag is rebuilt from main; use the helper from the workflow's own commit.
# ci.yml's release smoke runs the same script on every pull request.
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api -H 'Accept: application/vnd.github.raw+json' \
"repos/$GITHUB_REPOSITORY/contents/electron/scripts/stage-bundled-uv.mjs?ref=$GITHUB_SHA" \
> "$RUNNER_TEMP/stage-bundled-uv.mjs"
node "$RUNNER_TEMP/stage-bundled-uv.mjs"
- name: Stage the OmniVoice GGUF runtime
if: matrix.gguf_platform != ''
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: omnivoice-tts-${{ matrix.gguf_platform }}
path: electron/build/omnivoice-tts
- name: Install locked dependencies
run: bun install --frozen-lockfile
- name: Validate and build Electron
run: bun run check:electron
- name: Load notarization helper from workflow
if: matrix.platform == 'darwin'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api -H 'Accept: application/vnd.github.raw+json' \
"repos/$GITHUB_REPOSITORY/contents/scripts/prepare-apple-notarization.sh?ref=$GITHUB_SHA" \
> "$RUNNER_TEMP/prepare-apple-notarization.sh"
- name: Package without publishing
env:
SUPERMETRY_APP_ID: ${{ vars.SUPERMETRY_APP_ID || secrets.SUPERMETRY_APP_ID }}
SUPERMETRY_INGEST_KEY: ${{ vars.SUPERMETRY_INGEST_KEY || secrets.SUPERMETRY_INGEST_KEY }}
SUPERMETRY_APP_HOST: ${{ vars.SUPERMETRY_APP_HOST || secrets.SUPERMETRY_APP_HOST }}
CSC_LINK: ${{ matrix.platform == 'darwin' && secrets.ELECTRON_MACOS_CSC_LINK || matrix.platform == 'win32' && secrets.ELECTRON_WINDOWS_CSC_LINK || '' }}
CSC_KEY_PASSWORD: ${{ matrix.platform == 'darwin' && secrets.ELECTRON_MACOS_CSC_KEY_PASSWORD || matrix.platform == 'win32' && secrets.ELECTRON_WINDOWS_CSC_KEY_PASSWORD || '' }}
APPLE_API_KEY: ${{ matrix.platform == 'darwin' && secrets.APPLE_API_KEY || '' }}
APPLE_API_KEY_ID: ${{ matrix.platform == 'darwin' && secrets.APPLE_API_KEY_ID || '' }}
APPLE_API_ISSUER: ${{ matrix.platform == 'darwin' && secrets.APPLE_API_ISSUER || '' }}
PUBLISH: ${{ inputs.publish }}
ALLOW_UNSIGNED: ${{ inputs.allow_unsigned }}
working-directory: electron
run: |
if [ "${{ matrix.platform }}" = darwin ] && [ "$PUBLISH" = true ] && [ "$ALLOW_UNSIGNED" != true ]; then
if [ -z "${CSC_LINK:-}" ] || [ -z "${CSC_KEY_PASSWORD:-}" ] || [ -z "${APPLE_API_KEY:-}" ] || [ -z "${APPLE_API_KEY_ID:-}" ] || [ -z "${APPLE_API_ISSUER:-}" ]; then
echo "Signed macOS publication requires Developer ID and Apple notarization credentials"; exit 1
fi
fi
mac_notarization_args=()
if [ "${{ matrix.platform }}" = darwin ]; then
source "$RUNNER_TEMP/prepare-apple-notarization.sh"
fi
# An empty CSC_LINK is interpreted as the working directory by the
# signer. Omit absent credentials rather than passing empty strings.
if [ -z "${CSC_LINK:-}" ]; then
unset CSC_LINK CSC_KEY_PASSWORD
elif [ "${{ matrix.platform }}" = darwin ]; then
# With discovery off and no identity name, electron-builder never looks in
# the keychain it imported CSC_LINK into and skips signing (v0.5.7-beta.1).
# Discovery is limited to that imported keychain, not the runner's.
export CSC_IDENTITY_AUTO_DISCOVERY=true
fi
# Apple's notary and ticket services drop connections: the staple
# lookup after a successful notarization (error 68, v0.5.7-beta.2 and
# twice in a row on v0.5.8-beta.1) and the notarization upload itself
# (abortedUpload). Only those transient failures build again (of the
# NSURLErrorDomain codes: timed out -1001, cannot connect -1004,
# connection lost -1005, offline -1009; never trust errors such as
# -1202), up to three attempts with a growing pause; a rejected
# notarization or a signing error fails at once.
set -o pipefail
attempt=1
retry_delay="${APPLE_RETRY_DELAY_SECONDS:-60}"
until bun x electron-builder --config electron-builder.config.mjs ${{ matrix.flags }} "${mac_notarization_args[@]}" --publish never 2>&1 | tee "$RUNNER_TEMP/electron-builder.log"; do
if [ "$attempt" -ge 3 ] || ! grep -Eq "Failed to staple|abortedUpload|NSURLErrorDomain Code=-10(01|04|05|09)([^0-9]|$)|The network connection was lost" "$RUNNER_TEMP/electron-builder.log"; then exit 1; fi
echo "::warning::Apple's notarization service dropped the connection (attempt $attempt); building again in $((retry_delay * attempt))s"
sleep $((retry_delay * attempt))
attempt=$((attempt + 1))
done
if [ "$RUNNER_OS" = Linux ]; then
node scripts/embed-appimage-update.mjs
fi
node tests/packaging-contract.mjs --artifact
node tests/update-package-contract.mjs --platform ${{ matrix.platform }} --arch ${{ matrix.arch }}
node ../scripts/create_store_artifact_manifest.mjs --platform=${{ matrix.platform }} --arch=${{ matrix.arch }}
# SignPath signing. Order matters: electron-builder already wrote the
# updater feed (sha512, size) and the .blockmap from the UNSIGNED installer.
# Signing changes the bytes, so after the signed installer is put back,
# apply-signed-windows.mjs regenerates the blockmap and rewrites the feed
# hashes. All of this happens in the build leg, before the installers and
# feeds are uploaded; the release job then verifies the feed sha512 against
# the bytes and only afterwards writes SHA256SUMS.txt.
- name: Upload the unsigned Windows installer for SignPath
id: upload-unsigned-installer
if: env.SIGNPATH_ENABLED == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: signpath-unsigned-${{ matrix.platform }}-${{ matrix.arch }}
retention-days: ${{ inputs.rehearsal && 3 || 7 }}
if-no-files-found: error
path: electron/release/VoiceStudio-*.exe
- name: Sign the Windows installer with SignPath
if: env.SIGNPATH_ENABLED == 'true'
timeout-minutes: 70
uses: signpath/github-action-submit-signing-request@f6d04783b4569d051e0c80105fe66e82819d0092 # v3.0
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: ${{ vars.SIGNPATH_ORGANIZATION_ID }}
project-slug: ${{ vars.SIGNPATH_PROJECT_SLUG }}
signing-policy-slug: ${{ env.SIGNPATH_POLICY }}
github-artifact-id: ${{ steps.upload-unsigned-installer.outputs.artifact-id }}
wait-for-completion: true
wait-for-completion-timeout-in-seconds: 4000
output-artifact-directory: electron/release-signed
- name: Replace the installer with the signed one and refresh the update feed
if: env.SIGNPATH_ENABLED == 'true'
working-directory: electron
env:
GH_TOKEN: ${{ github.token }}
run: |
# The checkout is the release tag, which predates this helper when an
# older tag is rebuilt from main (the documented test dispatch); load it
# from the workflow's own commit, like the other release helpers. It
# resolves electron-builder from the working directory (electron/).
gh api -H 'Accept: application/vnd.github.raw+json' \
"repos/$GITHUB_REPOSITORY/contents/electron/scripts/apply-signed-windows.mjs?ref=$GITHUB_SHA" \
> "$RUNNER_TEMP/apply-signed-windows.mjs"
node "$RUNNER_TEMP/apply-signed-windows.mjs" release-signed release
node tests/update-package-contract.mjs --platform ${{ matrix.platform }} --arch ${{ matrix.arch }}
node ../scripts/create_store_artifact_manifest.mjs --platform=${{ matrix.platform }} --arch=${{ matrix.arch }}
- name: Verify macOS signing and notarization before publication
if: inputs.publish == true && matrix.platform == 'darwin'
env:
HAS_CREDENTIALS: ${{ secrets.ELECTRON_MACOS_CSC_LINK != '' }}
ALLOW_UNSIGNED: ${{ inputs.allow_unsigned }}
run: |
# A Windows unsigned exception must not bypass a signed Mac's assessment.
if [ "$ALLOW_UNSIGNED" = true ] && [ "$HAS_CREDENTIALS" != true ]; then
echo "Explicit unsigned macOS publication: no Developer ID is configured"
exit 0
fi
APP=$(find electron/release -maxdepth 2 -name VoiceStudio.app -type d -print -quit)
test -n "$APP"
codesign --verify --deep --strict "$APP"
spctl --assess --type execute --verbose=2 "$APP"
xcrun stapler validate "$APP"
- name: Verify Windows installer signature before publication
if: inputs.publish == true && inputs.allow_unsigned != true && matrix.platform == 'win32'
shell: pwsh
run: |
$installers = @(Get-ChildItem electron/release/VoiceStudio-*.exe)
if ($installers.Count -eq 0) { throw "No installer to verify" }
foreach ($installer in $installers) {
$signature = Get-AuthenticodeSignature $installer.FullName
if ($signature.Status -ne 'Valid') { throw "Installer signature is not trusted: $($installer.Name)" }
}
# Measure what each leg actually ships; the release notes are built from these
# reports. v0.5.7-beta.1 shipped a macOS bundle whose signing was skipped silently.
- name: Report and enforce macOS signing
if: matrix.platform == 'darwin'
env:
HAS_CREDENTIALS: ${{ secrets.ELECTRON_MACOS_CSC_LINK != '' }}
run: |
APP=$(find electron/release -maxdepth 2 -name VoiceStudio.app -type d -print -quit)
test -n "$APP" || { echo "No VoiceStudio.app to verify"; exit 1; }
# An invalid bundle signature makes browser downloads open as "damaged".
codesign --verify --deep --strict "$APP" || { echo "macOS bundle signature is invalid"; exit 1; }
# stapler validate reaches Apple over the network; retry so a dropped
# connection is not reported as an unsigned app (v0.5.7-beta.2 tag run).
validate_stapled() {
for attempt in 1 2 3 4; do
xcrun stapler validate "$APP" && return 0
sleep $((attempt * 10))
done
return 1
}
if codesign -dvv "$APP" 2>&1 | grep -q '^Authority=Developer ID Application:' && validate_stapled; then
STATUS=notarized
elif [ "$HAS_CREDENTIALS" = true ]; then
echo "Developer ID credentials are configured but the app is not signed and notarized with them"; exit 1
else
STATUS=adhoc
fi
mkdir -p electron/release-signing
printf '{"platform":"darwin","arch":"%s","status":"%s"}\n' "${{ matrix.arch }}" "$STATUS" > "electron/release-signing/signing-darwin-${{ matrix.arch }}.json"
- name: Report and enforce Windows signing
if: matrix.platform == 'win32'
shell: pwsh
env:
HAS_CREDENTIALS: ${{ secrets.ELECTRON_WINDOWS_CSC_LINK != '' || env.SIGNPATH_ENABLED == 'true' }}
TEST_SIGNED: ${{ env.REHEARSAL == 'true' && env.SIGNPATH_ENABLED == 'true' && env.SIGNPATH_POLICY == 'test-signing' }}
run: |
$installers = @(Get-ChildItem electron/release/VoiceStudio-*.exe)
if ($installers.Count -eq 0) { throw "No installer to verify" }
# A rehearsal's test certificate chains to no trusted root. Accept that
# one failure only: the signature must be intact (no HashMismatch) and
# its chain may fail on nothing but the untrusted root.
if ($env:TEST_SIGNED -eq 'true') {
$bad = @()
foreach ($installer in $installers) {
$signature = Get-AuthenticodeSignature $installer.FullName
if (-not $signature.SignerCertificate) { $bad += "$($installer.Name): not signed"; continue }
if ($signature.Status -eq 'Valid') { continue }
if ($signature.Status -notin @('UnknownError', 'NotTrusted')) { $bad += "$($installer.Name): $($signature.Status)"; continue }
$chain = [System.Security.Cryptography.X509Certificates.X509Chain]::new()
$chain.ChainPolicy.RevocationMode = 'NoCheck'
[void]$chain.Build($signature.SignerCertificate)
$other = @($chain.ChainStatus | Where-Object { $_.Status -ne 'UntrustedRoot' })
if ($other.Count -ne 0) { $bad += "$($installer.Name): $(($other.Status) -join ', ')" }
}
if ($bad.Count -ne 0) { throw "SignPath test signing did not leave intact signatures: $($bad -join '; ')" }
New-Item -ItemType Directory -Force electron/release-signing | Out-Null
Set-Content "electron/release-signing/signing-win32-${{ matrix.arch }}.json" ('{"platform":"win32","arch":"${{ matrix.arch }}","status":"test-signed"}')
exit 0
}
$unsigned = @($installers | Where-Object { (Get-AuthenticodeSignature $_.FullName).Status -ne 'Valid' })
if ($unsigned.Count -eq 0) { $status = 'signed' }
elseif ($env:HAS_CREDENTIALS -eq 'true') { throw "Windows signing is configured but these installers are not validly signed: $($unsigned.Name -join ', ')" }
else { $status = 'unsigned' }
New-Item -ItemType Directory -Force electron/release-signing | Out-Null
Set-Content "electron/release-signing/signing-win32-${{ matrix.arch }}.json" ('{"platform":"win32","arch":"${{ matrix.arch }}","status":"' + $status + '"}')
- name: Report Linux signing
if: matrix.platform == 'linux'
run: |
mkdir -p electron/release-signing
printf '{"platform":"linux","arch":"%s","status":"not-applicable"}\n' "${{ matrix.arch }}" > "electron/release-signing/signing-linux-${{ matrix.arch }}.json"
- name: Save the signing report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: electron-signing-${{ matrix.platform }}-${{ matrix.arch }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
path: electron/release-signing/signing-*.json
- name: Bundled native code must run on the Snap base (glibc <= 2.35)
if: matrix.platform == 'linux'
run: python3 scripts/check_glibc_floor.py electron/release/linux-unpacked/resources/native
- name: Packaged startup smoke test
working-directory: electron
run: |
if [ "$RUNNER_OS" = Linux ]; then
for image in release/VoiceStudio-*-linux-x64.AppImage; do
VOICESTUDIO_PACKAGED_EXE="electron/$image" xvfb-run -a node tests/packaged-smoke.mjs --setup
done
else
node tests/packaged-smoke.mjs --setup
fi
- name: Save installers and updater metadata for review
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: electron-release-${{ matrix.platform }}-${{ matrix.arch }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
path: |
electron/release/VoiceStudio-*
electron/release/electron-*.yml
electron/release/store-artifact-manifest-*.json
# Both phone apps are required on the same tag as desktop. App Store uploads
# remain separate; GitHub users sideload the unsigned IPA with their Apple ID.
mobile:
needs: validate
# A called job may not ask for more than this grant, even one its `if`
# skips: mobile-release.yml's mobile-v* release job needs contents: write,
# and without it GitHub rejects the whole run at startup. Its other jobs
# still get only the contents: read it sets at the top.
permissions:
contents: write
uses: ./.github/workflows/mobile-release.yml
with:
# A rehearsal has no tag: it builds the dispatched commit, unsigned.
release_ref: ${{ inputs.rehearsal && github.sha || inputs.release_tag || github.ref_name }}
rehearsal: ${{ inputs.rehearsal == true }}
secrets: inherit
# A rehearsal runs this job up to the draft: it collects and verifies every
# asset, then stops. Each publishing step is skipped by `if` and refuses a
# rehearsal again in its script. A rehearsal also runs when some build legs
# failed: it verifies the legs that built and fails at the end, naming the
# ones that did not. A release still needs every leg.
release:
needs: [validate, package, mobile]
if: ${{ success() || (inputs.rehearsal == true && !cancelled() && needs.validate.result == 'success') }}
runs-on: ubuntu-latest
permissions:
contents: write
# Dispatch docker.yml after publishing: GITHUB_TOKEN releases fire no `release` event.
actions: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# A rehearsal names files after the tag the version would get; no tag exists.
TAG: ${{ inputs.rehearsal && format('v{0}', needs.validate.outputs.version) || inputs.release_tag || github.ref_name }}
SUNSET_TAG: ${{ vars.TAURI_SUNSET_TAG }}
PUBLISH: ${{ inputs.publish }}
CHANNEL: ${{ needs.validate.outputs.channel }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ env.RELEASE_REF }}
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: electron-release-*
merge-multiple: true
path: release-assets
# One download per phone app, each into its own folder: a pattern that
# matches a single artifact extracts it without the artifact-name folder,
# which would lose the surviving app when the other phone leg fails.
- name: Download the Android build
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: VoiceStudio-android-release
path: phone-assets/VoiceStudio-android-release
- name: Download the iPhone build
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: VoiceStudio-ios-unsigned
path: phone-assets/VoiceStudio-ios-unsigned
- name: Collect phone binaries
run: |
VERSION="${TAG#v}"
mkdir -p release-assets
# A release needs all three; a rehearsal lists a missing one and goes on.
collect() {
if [ -f "$1" ]; then cp "$1" "$2"
elif [ "$REHEARSAL" = true ]; then echo "phone binary ${2##*/}" >> "$RUNNER_TEMP/rehearsal-missing-phone.txt"
else echo "Missing phone binary $1"; exit 1
fi
}
collect phone-assets/VoiceStudio-android-release/VoiceStudio.apk "release-assets/VoiceStudio-${VERSION}-android.apk"
collect phone-assets/VoiceStudio-android-release/VoiceStudio.aab "release-assets/VoiceStudio-${VERSION}-android.aab"
collect phone-assets/VoiceStudio-ios-unsigned/VoiceStudio-unsigned.ipa "release-assets/VoiceStudio-${VERSION}-ios-unsigned.ipa"
- name: Validate all platforms before creating a release
run: |
if [ "$REHEARSAL" = true ]; then
python3 scripts/prepare_electron_release.py --assets release-assets --rehearsal --missing-report "$RUNNER_TEMP/rehearsal-missing-desktop.txt" --repo "$GITHUB_REPOSITORY"
else
python3 scripts/prepare_electron_release.py --assets release-assets --tag "$TAG" --repo "$GITHUB_REPOSITORY"
fi
- name: Preserve the final Tauri updater feeds
# Archived Tauri clients read `latest/download`, which never serves a
# prerelease, so only Stable releases carry the sunset feeds.
if: env.CHANNEL == 'stable'
run: |
test "$SUNSET_TAG" = "v0.5.3" || { echo "TAURI_SUNSET_TAG must be v0.5.3 before releasing"; exit 1; }
# Every release carries copies pointing to immutable v0.5.3 payloads
# so archived Tauri clients never receive Electron installers.
gh release download "$SUNSET_TAG" --pattern latest.json --dir release-assets
gh release download "$SUNSET_TAG" --pattern latest-user.json --dir release-assets
if [ "$REHEARSAL" = true ]; then
python3 scripts/prepare_electron_release.py --assets release-assets --rehearsal --missing-report "$RUNNER_TEMP/rehearsal-missing-desktop.txt" --sunset-tag "$SUNSET_TAG" --repo "$GITHUB_REPOSITORY"
else
python3 scripts/prepare_electron_release.py --assets release-assets --tag "$TAG" --sunset-tag "$SUNSET_TAG" --repo "$GITHUB_REPOSITORY"
fi
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: electron-signing-*
merge-multiple: true
path: release-signing
- name: Describe downloads and signing per platform
# The checkout is the release tag, which predates this helper when an older
# tag is rebuilt from main; use the helper from the workflow's own commit.
run: |
gh api -H "Accept: application/vnd.github.raw" \
"repos/$GITHUB_REPOSITORY/contents/scripts/release_signing_notes.py?ref=$GITHUB_SHA" \
> "$RUNNER_TEMP/release_signing_notes.py"
# One download-and-signing table (desktop and phones) leads the notes, so
# downloaders see it before the changelog section and its Highlights.
NOTES_ARGS=(--assets release-assets --base-url "https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG")
if [ "$REHEARSAL" = true ]; then NOTES_ARGS+=(--rehearsal); fi
{
# An older tag's changelog section may carry its own download table; it is dropped.
python3 "$RUNNER_TEMP/release_signing_notes.py" "${NOTES_ARGS[@]}" --notes release-assets/RELEASE_NOTES.md release-signing
} > "$RUNNER_TEMP/RELEASE_NOTES.md"
mv "$RUNNER_TEMP/RELEASE_NOTES.md" release-assets/RELEASE_NOTES.md
- name: Rehearsal - check the feeds the release would carry
if: inputs.rehearsal == true
run: |
# What the draft check below reads from GitHub, read from the local assets.
find release-assets -maxdepth 1 -type f ! -name RELEASE_NOTES.md -printf '%f\n' | python3 scripts/check_electron_release_assets.py --foreign-feeds "$CHANNEL"
{
echo "## Release rehearsal for $TAG ($CHANNEL)"
echo
echo "Built and verified from $GITHUB_SHA. Nothing was published."
echo
echo '```'
cat release-assets/SHA256SUMS.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Rehearsal - save the release notes and checksums
if: inputs.rehearsal == true
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: electron-rehearsal-notes
retention-days: 3
if-no-files-found: error
path: |
release-assets/RELEASE_NOTES.md
release-assets/SHA256SUMS.txt
# Runs even when an earlier rehearsal step failed, so the missing legs
# are always listed.
- name: Rehearsal - fail when a build leg produced nothing
if: ${{ !cancelled() && inputs.rehearsal == true }}
run: |
cat "$RUNNER_TEMP"/rehearsal-missing-*.txt 2>/dev/null > "$RUNNER_TEMP/rehearsal-missing.txt" || true
if [ -s "$RUNNER_TEMP/rehearsal-missing.txt" ]; then
{ echo; echo "### Missing (their build legs failed)"; echo; sed 's/^/- /' "$RUNNER_TEMP/rehearsal-missing.txt"; } >> "$GITHUB_STEP_SUMMARY"
echo "::error::The rehearsal verified the legs that built; these are missing:"
cat "$RUNNER_TEMP/rehearsal-missing.txt"
exit 1
fi
- name: Create or update draft
if: inputs.rehearsal != true
run: |
# Rehearsals never publish (tests/test_release_rehearsal.py).
if [ "$REHEARSAL" != false ]; then echo "::error::A rehearsal run reached a publishing step"; exit 1; fi
# A beta is always a prerelease so GitHub never makes it `latest`.
PRERELEASE=false
if [ "$CHANNEL" = beta ]; then PRERELEASE=true; fi
if ! gh release view "$TAG" >/dev/null 2>&1; then
gh release create "$TAG" --verify-tag --draft --prerelease="$PRERELEASE" --title "$TAG — VoiceStudio" --notes-file release-assets/RELEASE_NOTES.md
fi
test "$(gh release view "$TAG" --json isDraft --jq .isDraft)" = true || { echo "Refusing to replace a published release"; exit 1; }
gh release edit "$TAG" --prerelease="$PRERELEASE" --notes-file release-assets/RELEASE_NOTES.md
find release-assets -maxdepth 1 -type f ! -name RELEASE_NOTES.md -print0 | xargs -0 gh release upload "$TAG" --clobber
# A reused draft keeps assets from earlier runs that --clobber never
# removes, so check what the draft actually carries.
gh release view "$TAG" --json assets --jq '.assets[].name' | python3 scripts/check_electron_release_assets.py --foreign-feeds "$CHANNEL"
- name: Publish only when explicitly requested
id: publish_release
if: github.event_name == 'workflow_dispatch' && inputs.publish == true && inputs.rehearsal != true
run: |
# Rehearsals never publish (tests/test_release_rehearsal.py).
if [ "$REHEARSAL" != false ]; then echo "::error::A rehearsal run reached a publishing step"; exit 1; fi
if [ "$CHANNEL" = beta ]; then
gh release edit "$TAG" --draft=false --prerelease=true --latest=false
else
gh release edit "$TAG" --draft=false --prerelease=false --latest
fi
# Prove where `latest` points now: stable users follow `latest/download`,
# so a beta there would update every stable install onto it.
latest="$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq .tag_name)"
case "$latest" in *-beta.*)
echo "::error::Beta $latest is the latest release; stable users would update onto it"
exit 1;;
esac
if [ "$CHANNEL" = beta ] && [ "$latest" = "$TAG" ]; then
echo "::error::Beta $TAG became the latest release; stable users would update onto it"
exit 1
fi
if [ "$CHANNEL" = stable ] && [ "$latest" != "$TAG" ]; then
echo "::error::Stable $TAG is not the latest release (latest is $latest)"
exit 1
fi
# GITHUB_TOKEN publication does not emit another workflow's release event.
- name: Update the Android repository after stable publication
if: github.event_name == 'workflow_dispatch' && inputs.publish == true && inputs.rehearsal != true
run: |
# Rehearsals never publish (tests/test_release_rehearsal.py).
if [ "$REHEARSAL" != false ]; then echo "::error::A rehearsal run reached a publishing step"; exit 1; fi
if [ "$CHANNEL" = stable ]; then
gh workflow run android-repository.yml --ref main
fi
# docker.yml publishes release images on `release: published`, which a
# GITHUB_TOKEN publish cannot trigger; dispatch its release backfill path.
# Only Stable moves `:stable`; a beta gets `:beta` and its exact tag.
- name: Publish release container images
if: ${{ !cancelled() && steps.publish_release.outcome == 'success' && github.event_name == 'workflow_dispatch' && inputs.publish == true && inputs.rehearsal != true }}
run: |
# Rehearsals never publish (tests/test_release_rehearsal.py).
if [ "$REHEARSAL" != false ]; then echo "::error::A rehearsal run reached a publishing step"; exit 1; fi
PROMOTE=false
if [ "$CHANNEL" = stable ]; then PROMOTE=true; fi
gh workflow run docker.yml --ref main \
-f backfill_release=true -f release_ref="$TAG" -f promote_stable="$PROMOTE"