Repository navigation
697 lines (642 loc) · 33.7 KB
/
Copy pathrelease.yml
File metadata and controls
697 lines (642 loc) · 33.7 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
flavor:
description: "Build flavor: stable or dev"
type: choice
options:
- stable
- dev
default: stable
publish_dev:
description: "Dev only, from main: sign this build and publish it to the rolling dev pre-release that Scribe Dev updates from"
type: boolean
default: false
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}-${{ inputs.flavor || 'stable' }}
cancel-in-progress: false
env:
WHISPER_CPP_VERSION: v1.9.1
WHISPER_CPP_COMMIT: f049fff95a089aa9969deb009cdd4892b3e74916
jobs:
build-windows:
name: Build release candidate
runs-on: windows-latest
timeout-minutes: 60
outputs:
version: ${{ steps.metadata.outputs.version }}
flavor: ${{ steps.metadata.outputs.flavor }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Validate release metadata
id: metadata
shell: pwsh
env:
SCRIBE_GITHUB_APP_CLIENT_ID: ${{ vars.SCRIBE_GITHUB_APP_CLIENT_ID }}
run: |
$packageVersion = (Get-Content app/package.json -Raw | ConvertFrom-Json).version
$tauriVersion = (Get-Content app/src-tauri/tauri.conf.json -Raw | ConvertFrom-Json).version
$cargoVersion = (Select-String -Path app/src-tauri/Cargo.toml -Pattern '^version = "([^"]+)"$' | Select-Object -First 1).Matches.Groups[1].Value
$coreVersion = (Select-String -Path crates/scribe-core/Cargo.toml -Pattern '^version = "([^"]+)"$' | Select-Object -First 1).Matches.Groups[1].Value
if (-not $packageVersion -or $packageVersion -ne $tauriVersion -or $packageVersion -ne $cargoVersion -or $packageVersion -ne $coreVersion) {
throw "Version mismatch: package=$packageVersion tauri=$tauriVersion cargo=$cargoVersion core=$coreVersion"
}
if ("${{ github.ref_type }}" -eq "tag" -and "${{ github.ref_name }}" -ne "v$packageVersion") {
throw "Tag ${{ github.ref_name }} does not match configured version v$packageVersion"
}
if ($env:SCRIBE_GITHUB_APP_CLIENT_ID -notmatch '^Iv[0-9A-Za-z]+$') {
throw "Repository variable SCRIBE_GITHUB_APP_CLIENT_ID must contain the GitHub App client ID (Iv...)."
}
$flavor = "${{ inputs.flavor || 'stable' }}"
$publishDev = "${{ inputs.publish_dev }}" -eq "true"
if ($publishDev -and $flavor -ne "dev") { throw "publish_dev needs the dev flavor" }
if ($publishDev -and "${{ github.ref }}" -ne "refs/heads/main") { throw "Only main publishes to the dev channel" }
# Every dev build gets its own version, a numbered pre-release of the
# next patch (0.9.0 -> 0.9.1-<run number>), so Scribe Dev sees each
# one as newer than the last. WiX accepts only a numeric pre-release.
$version = $packageVersion
if ($flavor -eq "dev") {
$parts = $packageVersion.Split(".")
$version = "{0}.{1}.{2}-{3}" -f $parts[0], $parts[1], ([int]$parts[2] + 1), $env:GITHUB_RUN_NUMBER
}
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
"flavor=$flavor" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
$stage = Join-Path $env:RUNNER_TEMP "scribe-release"
New-Item -ItemType Directory -Force -Path $stage | Out-Null
Set-Content -Path (Join-Path $stage "version.txt") -Value $version -NoNewline
Set-Content -Path (Join-Path $stage "flavor.txt") -Value $flavor -NoNewline
# The SBOM covers what ships: the app's npm packages and the Rust crates
# of the workspace Cargo.lock (see sbom-source.ps1). CI's "Release SBOM"
# job runs the same three steps on every pull request.
- name: Stage the SBOM source
shell: pwsh
run: ./.github/scripts/sbom-source.ps1 -Out "$env:RUNNER_TEMP\scribe"
- name: Generate source SBOM
uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3
with:
path: ${{ runner.temp }}/scribe
format: cyclonedx-json
output-file: ${{ runner.temp }}/scribe-release/scribe-${{ steps.metadata.outputs.version }}.cdx.json
upload-artifact: false
upload-release-assets: false
dependency-snapshot: false
- name: Check the SBOM lists the Rust crates and npm packages
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: ./.github/scripts/check-sbom.ps1 -Sbom "$env:RUNNER_TEMP\scribe-release\scribe-${{ steps.metadata.outputs.version }}.cdx.json" -Repository "${{ github.repository }}"
- name: Add bundled whisper.cpp to SBOM
shell: pwsh
run: |
$path = "$env:RUNNER_TEMP\scribe-release\scribe-${{ steps.metadata.outputs.version }}.cdx.json"
$sbom = Get-Content $path -Raw | ConvertFrom-Json
$whisper = [ordered]@{
type = "library"
name = "whisper.cpp"
version = $env:WHISPER_CPP_VERSION.TrimStart("v")
purl = "pkg:github/ggml-org/whisper.cpp@$($env:WHISPER_CPP_VERSION.TrimStart('v'))"
externalReferences = @(
[ordered]@{
type = "vcs"
url = "https://github.com/ggml-org/whisper.cpp/tree/$env:WHISPER_CPP_COMMIT"
}
)
}
$sbom.components = @($sbom.components) + $whisper
$sbom | ConvertTo-Json -Depth 100 | Set-Content $path -Encoding utf8
Get-Content $path -Raw | ConvertFrom-Json | Out-Null
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
cache: npm
cache-dependency-path: app/package-lock.json
# release-kit's check (the root dev dependency) covers every file that
# carries the version (.release.json), including the root package.json
# and both lock files.
- name: Tag matches every version file
if: github.ref_type == 'tag'
shell: bash
env:
TAG: ${{ github.ref_name }}
run: |
npm ci --ignore-scripts --no-audit --no-fund --allow-git=root
npx --no-install release-kit release --verify-tag "$TAG"
- uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@c8037a86dde8214a8310e9f54a8fc61ab362aa31 # v2
with:
workspaces: ". -> target"
- name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@7fe84289ddbf750f7eff9f8e4588e600e1dd06c8 # v1.8.1
with:
vulkan_version: 1.4.350.0
install_runtime: true
cache: true
- name: Set up MSVC environment
shell: pwsh
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = (& $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath).Trim()
if (-not $installationPath) { throw "Visual Studio with the x64 C++ toolchain was not found" }
$devCommand = Join-Path $installationPath "Common7\Tools\VsDevCmd.bat"
if (-not (Test-Path $devCommand)) { throw "VsDevCmd.bat was not found at $devCommand" }
& cmd.exe /s /c "`"$devCommand`" -no_logo -arch=x64 -host_arch=x64 && set" |
ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') {
"$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
}
}
# Install scripts stay off so no dependency runs code at install time;
# esbuild's is the only one the Windows build needs, so it runs on its own.
- name: Install and validate application dependencies
working-directory: app
# pwsh fails a step only on its last command's exit code, so each
# command is checked.
run: |
npm ci --ignore-scripts
if ($LASTEXITCODE -ne 0) { throw "npm ci failed" }
npm rebuild esbuild
if ($LASTEXITCODE -ne 0) { throw "npm rebuild esbuild failed" }
npm audit
if ($LASTEXITCODE -ne 0) { throw "npm audit failed" }
npm run lint
if ($LASTEXITCODE -ne 0) { throw "npm run lint failed" }
npm test
if ($LASTEXITCODE -ne 0) { throw "npm test failed" }
npm run build
if ($LASTEXITCODE -ne 0) { throw "npm run build failed" }
# One command per step: a pwsh step fails only on its last command's
# exit code.
- name: Check Rust formatting
run: cargo fmt --all --check
- name: Run clippy
run: cargo clippy --locked --workspace --all-targets -- -D warnings
- name: Run backend tests
run: cargo test --locked --workspace
- name: Build reviewed whisper.cpp source with Vulkan
shell: pwsh
run: |
$src = "$env:RUNNER_TEMP\wcpp"
git clone --depth 1 --branch "$env:WHISPER_CPP_VERSION" https://github.com/ggml-org/whisper.cpp $src
$actual = (git -C $src rev-parse HEAD).Trim()
if ($actual -ne $env:WHISPER_CPP_COMMIT) {
throw "whisper.cpp commit $actual did not match reviewed commit $env:WHISPER_CPP_COMMIT"
}
# Scribe's own Parakeet sidecar builds inside the same tree.
Add-Content "$src\examples\CMakeLists.txt" "add_subdirectory(`"$($env:GITHUB_WORKSPACE -replace '\\','/')/app/sidecar/scribe-parakeet`" `"`${CMAKE_BINARY_DIR}/scribe-parakeet`")"
Push-Location $src
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DGGML_VULKAN=ON `
-DGGML_NATIVE=OFF `
-DBUILD_SHARED_LIBS=ON `
-DWHISPER_BUILD_EXAMPLES=ON `
-DWHISPER_BUILD_TESTS=OFF `
-DWHISPER_BUILD_SERVER=ON
if ($LASTEXITCODE -ne 0) { throw "Configuring whisper.cpp failed" }
cmake --build build -j
if ($LASTEXITCODE -ne 0) { throw "Building whisper.cpp failed" }
Pop-Location
$cli = Get-ChildItem -Path "$src\build" -Recurse -Filter whisper-cli.exe | Select-Object -First 1
if (-not $cli) { throw "whisper-cli.exe not found after the Vulkan build" }
$bin = Split-Path $cli.FullName
$dest = "app/src-tauri/resources/bin/windows"
New-Item -ItemType Directory -Force -Path $dest | Out-Null
$needed = @("whisper-cli.exe", "whisper-server.exe", "scribe-parakeet.exe", "whisper.dll", "parakeet.dll", "ggml.dll", "ggml-base.dll", "ggml-cpu.dll", "ggml-vulkan.dll")
foreach ($name in $needed) {
$file = Get-ChildItem -Path $bin -Recurse -Filter $name | Select-Object -First 1
if (-not $file) { throw "Missing $name in the Vulkan build output" }
Copy-Item $file.FullName -Destination $dest
}
# The build never sees the updater signing key: it skips the updater
# artifacts, and the next step signs the installer on its own, so no
# build script, proc macro or npm package can read the key.
- name: Build installers
working-directory: app
shell: pwsh
env:
SCRIBE_GITHUB_APP_CLIENT_ID: ${{ vars.SCRIBE_GITHUB_APP_CLIENT_ID }}
run: |
$configs = @("--config", "src-tauri/tauri.unsigned-build.conf.json")
if ("${{ steps.metadata.outputs.flavor }}" -eq "dev") {
$configs += @("--config", "src-tauri/tauri.dev-flavor.conf.json")
$devVersion = Join-Path $env:RUNNER_TEMP "dev-version.conf.json"
@{ version = "${{ steps.metadata.outputs.version }}" } | ConvertTo-Json | Set-Content $devVersion -Encoding utf8
$configs += @("--config", $devVersion)
}
npm run tauri -- build @configs
# The end-to-end test input (the e2e-audio feature) must never ship: no
# executable of this build may carry its environment variable.
- name: Check the build has no test input
shell: pwsh
run: |
$exes = @(Get-ChildItem target/release -Filter *.exe -File)
if ($exes.Count -eq 0) { throw "No executable was built" }
foreach ($exe in $exes) {
$text = [System.Text.Encoding]::ASCII.GetString([System.IO.File]::ReadAllBytes($exe.FullName))
if ($text.Contains("SCRIBE_E2E_AUDIO_WAV")) { throw "$($exe.Name) contains the end-to-end test input" }
}
# Only tagged releases and dev builds explicitly published from main
# are signed, so other manual builds never touch the key. The signature
# is what latest.json (or latest-dev.json) carries and what installed
# copies verify against the pubkey in tauri.conf.json.
- name: Sign updater artifact
if: github.ref_type == 'tag' || (inputs.flavor == 'dev' && inputs.publish_dev && github.ref == 'refs/heads/main')
working-directory: app
shell: pwsh
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
$setup = @(Get-ChildItem -Path "../target/release/bundle/nsis" -Filter "*-setup.exe")
if ($setup.Count -ne 1) { throw "Expected one NSIS installer to sign, found $($setup.Count)" }
npx --no-install tauri signer sign $setup[0].FullName
if ($LASTEXITCODE -ne 0) { throw "Signing the updater artifact failed" }
if (-not (Test-Path "$($setup[0].FullName).sig")) { throw "The signer did not write $($setup[0].Name).sig" }
- name: Stage and validate release candidate
shell: pwsh
run: |
$stage = "$env:RUNNER_TEMP\scribe-release"
$nsisDir = "target/release/bundle/nsis"
$msiDir = "target/release/bundle/msi"
$setup = @(Get-ChildItem -Path $nsisDir -Filter "*-setup.exe")
$msi = @(Get-ChildItem -Path $msiDir -Filter "*.msi")
if ($setup.Count -ne 1) { throw "Expected one NSIS installer, found $($setup.Count)" }
if ($msi.Count -ne 1) { throw "Expected one MSI installer, found $($msi.Count)" }
# GitHub turns spaces in asset names into dots ("Scribe Dev_..."),
# so stage the names it will publish and the manifest URLs match.
$setupName = $setup[0].Name -replace ' ', '.'
Copy-Item $setup[0].FullName -Destination (Join-Path $stage $setupName)
Copy-Item $msi[0].FullName -Destination (Join-Path $stage ($msi[0].Name -replace ' ', '.'))
$manifestPath = $null
if ("${{ github.ref_type }}" -eq "tag") {
$tag = "${{ github.ref_name }}"
$manifestPath = Join-Path $stage "latest.json"
} elseif ("${{ inputs.flavor }}" -eq "dev" -and "${{ inputs.publish_dev }}" -eq "true") {
# The rolling dev pre-release: Scribe Dev reads latest-dev.json
# (tauri.dev-flavor.conf.json); stable never sees it.
$tag = "dev"
$manifestPath = Join-Path $stage "latest-dev.json"
}
if ($manifestPath) {
$signature = "$($setup[0].FullName).sig"
if (-not (Test-Path $signature)) { throw "Missing Tauri updater signature for $($setup[0].Name)" }
Copy-Item $signature -Destination (Join-Path $stage "$setupName.sig")
$manifest = [ordered]@{
version = "${{ steps.metadata.outputs.version }}"
pub_date = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
platforms = @{
"windows-x86_64" = @{
signature = (Get-Content $signature -Raw).Trim()
url = "https://github.com/${{ github.repository }}/releases/download/$tag/$setupName"
}
}
}
$manifest | ConvertTo-Json -Depth 4 | Set-Content $manifestPath -Encoding utf8
$parsed = Get-Content $manifestPath -Raw | ConvertFrom-Json
if ($parsed.version -ne "${{ steps.metadata.outputs.version }}") { throw "Updater version mismatch" }
if (@($parsed.platforms.PSObject.Properties).Count -ne 1) { throw "Unexpected updater platforms" }
if ($parsed.platforms.'windows-x86_64'.signature -ne (Get-Content $signature -Raw).Trim()) { throw "Updater signature mismatch" }
if (-not $parsed.platforms.'windows-x86_64'.url.EndsWith("/$setupName")) { throw "Updater installer URL mismatch" }
}
$files = Get-ChildItem $stage -File | Where-Object Name -NotIn @("SHA256SUMS.txt", "version.txt", "flavor.txt") | Sort-Object Name
$lines = foreach ($file in $files) {
"{0} {1}" -f (Get-FileHash $file.FullName -Algorithm SHA256).Hash.ToLowerInvariant(), $file.Name
}
Set-Content -Path (Join-Path $stage "SHA256SUMS.txt") -Value $lines -Encoding ascii
- name: Upload release candidate
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: scribe-release-candidate
path: ${{ runner.temp }}/scribe-release/*
if-no-files-found: error
retention-days: 14
smoke-install:
name: Smoke install (${{ matrix.kind }})
needs: build-windows
runs-on: windows-latest
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
kind: [nsis, msi]
steps:
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: scribe-release-candidate
path: candidate
# Only the short speech clip the self-test transcribes.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: source
sparse-checkout: app/src-tauri/tests/fixtures
persist-credentials: false
# A hung msiexec, installer or app must fail the job (so the logs
# upload) instead of holding the runner for hours.
- name: Verify checksums, install candidate and transcribe a clip
timeout-minutes: 25
shell: pwsh
run: |
$candidate = (Resolve-Path candidate).Path
foreach ($line in Get-Content "$candidate\SHA256SUMS.txt") {
if ($line -notmatch '^([0-9a-f]{64}) (.+)$') { throw "Malformed checksum line: $line" }
$actual = (Get-FileHash (Join-Path $candidate $Matches[2]) -Algorithm SHA256).Hash.ToLowerInvariant()
if ($actual -ne $Matches[1]) { throw "Checksum mismatch for $($Matches[2])" }
}
if ("${{ matrix.kind }}" -eq "nsis") {
$installer = @(Get-ChildItem $candidate -Filter "*-setup.exe")
if ($installer.Count -ne 1) { throw "Expected one NSIS installer" }
$process = Start-Process $installer[0].FullName -ArgumentList "/S" -Wait -PassThru
if ($process.ExitCode -ne 0) { throw "NSIS install failed with $($process.ExitCode)" }
} else {
$installer = @(Get-ChildItem $candidate -Filter "*.msi")
if ($installer.Count -ne 1) { throw "Expected one MSI installer" }
# Start-Process joins ArgumentList with spaces and never quotes, so
# quote the paths: "Scribe Dev_..." otherwise reaches msiexec as
# two arguments and it waits forever on its modal usage dialog.
$process = Start-Process msiexec.exe -ArgumentList @("/i", "`"$($installer[0].FullName)`"", "/qn", "/norestart", "/L*V", "`"$env:RUNNER_TEMP\scribe-msi-install.log`"") -Wait -PassThru
if ($process.ExitCode -notin @(0, 3010)) { throw "MSI install failed with $($process.ExitCode)" }
}
$roots = @(
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*",
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*",
"HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
)
$entry = Get-ItemProperty $roots -ErrorAction SilentlyContinue |
Where-Object { $_.DisplayName -in @("Scribe", "Scribe Dev") } |
Select-Object -First 1
if (-not $entry) { throw "Scribe uninstall entry was not created" }
# WiX writes a dev pre-release (0.9.1-42) as a fourth number (0.9.1.42).
$expectedVersions = @("${{ needs.build-windows.outputs.version }}", ("${{ needs.build-windows.outputs.version }}" -replace '-', '.'))
if ($entry.DisplayVersion -notin $expectedVersions) {
throw "Installed version $($entry.DisplayVersion) did not match ${{ needs.build-windows.outputs.version }}"
}
$binaryName = if ($entry.DisplayName -eq "Scribe Dev") { "Scribe Dev.exe" } else { "Scribe.exe" }
$displayIcon = (([string]$entry.DisplayIcon).Trim('"') -replace ',\d+$', '').Trim()
$installLocation = ([string]$entry.InstallLocation).Trim().Trim('"')
$candidatePaths = @(
$displayIcon
if ($installLocation) { Join-Path $installLocation $binaryName }
) | Where-Object { $_ }
$exePath = $candidatePaths |
Where-Object { (Split-Path $_ -Leaf) -eq $binaryName -and (Test-Path $_ -PathType Leaf) } |
Select-Object -First 1
$exe = if ($exePath) { Get-Item $exePath }
if (-not $exe) { throw "Installed Scribe executable was not found" }
$installDir = $exe.Directory.FullName
foreach ($name in @("whisper-cli.exe", "whisper-server.exe", "scribe-parakeet.exe", "whisper.dll", "parakeet.dll", "ggml.dll", "ggml-base.dll", "ggml-cpu.dll", "ggml-vulkan.dll")) {
if (-not (Get-ChildItem $installDir -Recurse -Filter $name -ErrorAction SilentlyContinue | Select-Object -First 1)) {
throw "Installed bundle is missing $name"
}
}
$app = Start-Process $exe.FullName -PassThru
Start-Sleep -Seconds 10
if ($app.HasExited) { throw "Scribe exited during launch smoke test with $($app.ExitCode)" }
Stop-Process -Id $app.Id -Force
# The single-instance guard would hand the next launch to this copy.
if (-not $app.WaitForExit(30000)) { throw "Scribe did not stop after the launch smoke test" }
# End to end through the installed app: it starts as usual on this
# fresh runner profile, downloads the default model through its
# verified download path, transcribes the clip with the bundled
# whisper.cpp, writes the result and exits. Paths are quoted
# because Start-Process joins ArgumentList without quoting.
$clip = (Resolve-Path "source/app/src-tauri/tests/fixtures/jfk.wav").Path
$resultPath = Join-Path $env:RUNNER_TEMP "scribe-self-test.json"
$selfTest = Start-Process $exe.FullName -ArgumentList @("--self-test-transcribe", "`"$clip`"", "`"$resultPath`"") -PassThru
$null = $selfTest.Handle # keeps ExitCode readable after exit
if (-not $selfTest.WaitForExit(600000)) {
Stop-Process -Id $selfTest.Id -Force -ErrorAction SilentlyContinue
throw "The self-test did not finish within 10 minutes"
}
if (-not (Test-Path $resultPath)) { throw "The self-test exited with $($selfTest.ExitCode) and wrote no result" }
$result = Get-Content $resultPath -Raw | ConvertFrom-Json
Write-Host "Self-test: model $($result.modelId), $($result.latencyMs) ms, text: $($result.text)"
if (-not $result.ok) { throw "The self-test failed: $($result.error)" }
if ($selfTest.ExitCode -ne 0) { throw "The self-test reported success but exited with $($selfTest.ExitCode)" }
if ([string]::IsNullOrWhiteSpace($result.text)) { throw "The self-test transcript was empty" }
if ($result.text -notmatch "country") { throw "The self-test transcript did not match the clip: $($result.text)" }
if ($result.appVersion -ne "${{ needs.build-windows.outputs.version }}") {
throw "The self-test ran version $($result.appVersion), not ${{ needs.build-windows.outputs.version }}"
}
if ("${{ matrix.kind }}" -eq "msi") {
$uninstall = Start-Process msiexec.exe -ArgumentList @("/x", $entry.PSChildName, "/qn", "/norestart", "/L*V", "`"$env:RUNNER_TEMP\scribe-msi-uninstall.log`"") -Wait -PassThru
} else {
# Run the uninstaller directly: UninstallString is a quoted path,
# and passing it through cmd.exe breaks on spaces in that path.
$uninstaller = ([string]$entry.UninstallString).Trim().Trim('"')
if (-not (Test-Path $uninstaller -PathType Leaf)) { throw "NSIS uninstaller was not found at $uninstaller" }
$uninstall = Start-Process $uninstaller -ArgumentList "/S" -Wait -PassThru
}
if ($uninstall.ExitCode -notin @(0, 3010)) { throw "Uninstall failed with $($uninstall.ExitCode)" }
if (Test-Path $exe.FullName) { throw "Scribe executable remained after uninstall" }
- name: Collect app logs on failure
if: failure()
shell: pwsh
run: |
foreach ($id in @("com.natkins.scribe", "com.natkins.scribe.dev")) {
$logs = Join-Path $env:LOCALAPPDATA "$id\logs"
if (Test-Path $logs) {
Get-ChildItem $logs -Filter *.log | ForEach-Object {
Copy-Item $_.FullName (Join-Path $env:RUNNER_TEMP "scribe-app-$id-$($_.Name)")
}
}
}
- name: Upload installer logs on failure
if: failure()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: smoke-logs-${{ matrix.kind }}
path: |
${{ runner.temp }}/scribe-*.log
${{ runner.temp }}/scribe-self-test.json
if-no-files-found: ignore
retention-days: 14
# The Linux and macOS (beta) bundles: each workflow builds them, installs and
# launches them on a fresh runner and transcribes a clip, and keeps the
# tested files as an artifact. Stable builds only; Scribe Dev is Windows only.
linux:
name: Linux
if: (inputs.flavor || 'stable') == 'stable'
uses: ./.github/workflows/linux.yml
with:
release: true
macos:
name: macOS
if: (inputs.flavor || 'stable') == 'stable'
uses: ./.github/workflows/macos.yml
with:
release: true
# One folder with every platform's tested files and one SHA256SUMS.txt over
# all of them. Manual stable runs assemble it too, so the whole path short
# of publishing can be tried from a branch.
assemble:
name: Assemble release files
needs: [build-windows, smoke-install, linux, macos]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: scribe-release-candidate
path: parts/windows
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: scribe-linux
path: parts/linux
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: scribe-macos
path: parts/macos
- name: Merge and checksum
run: |
set -euo pipefail
mkdir release
for part in windows linux macos; do
(cd "parts/$part" && sha256sum --check --quiet SHA256SUMS.txt)
# The Windows list is written on Windows, with CRLF line ends.
while read -r _ name; do
name="${name%$'\r'}"
if [ -e "release/$name" ]; then
echo "$name is in more than one platform's files" >&2
exit 1
fi
cp "parts/$part/$name" "release/$name"
done < "parts/$part/SHA256SUMS.txt"
done
required=(Scribe-macos-universal.dmg Scribe-linux-x86_64.AppImage Scribe-linux-amd64.deb)
# Only tag builds are signed, so only they carry the updater manifest.
if [ "$GITHUB_REF_TYPE" = tag ]; then
required+=(latest.json)
fi
for name in "${required[@]}"; do
test -s "release/$name" || { echo "Missing $name" >&2; exit 1; }
done
(cd release && sha256sum -- * > SHA256SUMS.txt && cat SHA256SUMS.txt)
- name: Upload release files
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: scribe-release
path: release/*
if-no-files-found: error
retention-days: 14
publish:
name: Publish verified release
needs: assemble
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # the notes need the previous tag
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
# User-facing notes from the Conventional Commits since the previous
# release (release-kit), the same section the release commit wrote to
# CHANGELOG.md; not GitHub's list of pull request titles. The download
# guide (which file for which system, the macOS Gatekeeper steps and
# what beta means) follows them on every release.
- name: Release notes
env:
TAG: ${{ github.ref_name }}
run: |
npm ci --ignore-scripts --no-audit --no-fund --allow-git=root
npx --no-install release-kit notes --to "$TAG" > release-notes.md
test -s release-notes.md
printf '\n' >> release-notes.md
cat .github/release-downloads.md >> release-notes.md
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: scribe-release
path: release
- name: Attach verified files to release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
tag="${{ github.ref_name }}"
repo="${{ github.repository }}"
assets=(release/*)
if gh release view "$tag" --repo "$repo" >/dev/null 2>&1; then
gh release upload "$tag" "${assets[@]}" --clobber --repo "$repo"
gh release edit "$tag" --notes-file release-notes.md --repo "$repo"
else
gh release create "$tag" "${assets[@]}" --notes-file release-notes.md --verify-tag --repo "$repo"
fi
- name: Verify published release assets
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir downloaded
gh release download "${{ github.ref_name }}" --repo "${{ github.repository }}" --dir downloaded
cp release/SHA256SUMS.txt downloaded/
cd downloaded
sha256sum --check SHA256SUMS.txt
# Nothing on the release that the checksums do not cover.
extra="$(comm -13 <(awk '{print $2}' SHA256SUMS.txt | sort) <(ls | grep -vx SHA256SUMS.txt | sort))"
if [ -n "$extra" ]; then
echo "The release has files SHA256SUMS.txt does not cover: $extra" >&2
exit 1
fi
# The rolling `dev` pre-release that Scribe Dev updates from. A pre-release
# never becomes "latest", so stable installs (which read
# releases/latest/download/latest.json) never see it.
publish-dev:
name: Publish dev channel build
needs: [build-windows, smoke-install]
if: inputs.flavor == 'dev' && inputs.publish_dev && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: scribe-release-candidate
path: candidate
- name: Replace the dev pre-release assets
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
VERSION: ${{ needs.build-windows.outputs.version }}
run: |
set -euo pipefail
test -s candidate/latest-dev.json
test "$(jq -r .version candidate/latest-dev.json)" = "$VERSION"
notes="Rolling Scribe Dev build $VERSION from main at ${GITHUB_SHA::12}. For testing only; Scribe Dev installs update from here, stable installs never do."
if gh release view dev --repo "$REPO" >/dev/null 2>&1; then
gh api -X PATCH "repos/$REPO/git/refs/tags/dev" -f sha="$GITHUB_SHA" -F force=true >/dev/null
gh release edit dev --repo "$REPO" --prerelease --latest=false \
--title "Scribe Dev $VERSION" --notes "$notes"
# The manifest goes first and comes back last, so a Dev install
# never reads a manifest that points at a missing installer.
gh release delete-asset dev latest-dev.json --repo "$REPO" --yes 2>/dev/null || true
gh release view dev --repo "$REPO" --json assets --jq '.assets[].name' |
while read -r name; do
gh release delete-asset dev "$name" --repo "$REPO" --yes
done
else
gh release create dev --repo "$REPO" --target "$GITHUB_SHA" --prerelease --latest=false \
--title "Scribe Dev $VERSION" --notes "$notes"
fi
gh release upload dev --repo "$REPO" --clobber \
candidate/*-setup.exe candidate/*-setup.exe.sig candidate/*.msi \
candidate/*.cdx.json candidate/SHA256SUMS.txt
gh release upload dev --repo "$REPO" --clobber candidate/latest-dev.json
- name: Verify published dev assets
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir downloaded
gh release download dev --repo "${{ github.repository }}" --dir downloaded
cp candidate/SHA256SUMS.txt downloaded/
cd downloaded
sha256sum --check SHA256SUMS.txt