Repository navigation
719 lines (656 loc) · 29.8 KB
/
Copy pathdesktop-release.yml
File metadata and controls
719 lines (656 loc) · 29.8 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
711
712
713
714
715
716
717
718
719
name: Build & Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
release_tag:
description: "Optional GitHub Release tag to upload installers to"
required: false
type: string
upload_to_release:
description: "Upload installers to the GitHub Release named by release_tag"
required: false
default: false
type: boolean
permissions:
contents: write
concurrency:
group: desktop-release-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: 22
PNPM_VERSION: 10.13.1
RUST_TOOLCHAIN: nightly-2025-12-04
RELEASE_TAG: ${{ github.event_name == 'push' && github.ref_name || inputs.release_tag }}
SQLX_OFFLINE: "true"
SQLX_OFFLINE_DIR: ${{ github.workspace }}/crates/db/.sqlx
jobs:
prepare-release:
name: Prepare GitHub Release
if: ${{ github.event_name == 'push' || inputs.upload_to_release }}
runs-on: ubuntu-22.04
outputs:
apple_signing_enabled: ${{ steps.signing.outputs.apple_signing_enabled }}
windows_signing_enabled: ${{ steps.signing.outputs.windows_signing_enabled }}
windows_signing_method: ${{ steps.signing.outputs.windows_signing_method }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Require a release tag
run: test -n "$RELEASE_TAG"
- name: Require updater signing credentials
id: signing
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_P8_BASE64: ${{ secrets.APPLE_API_KEY_P8_BASE64 }}
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
EVSIGN_LICENSE_KEY: ${{ secrets.EVSIGN_LICENSE_KEY }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
missing=()
for name in \
TAURI_SIGNING_PRIVATE_KEY \
TAURI_SIGNING_PRIVATE_KEY_PASSWORD; do
if [ -z "${!name}" ]; then
missing+=("$name")
fi
done
if [ "${#missing[@]}" -ne 0 ]; then
echo "Missing required updater signing secrets: ${missing[*]}"
exit 1
fi
check_optional_signing() {
label="$1"
output_name="$2"
shift 2
configured=()
missing=()
for name in "$@"; do
if [ -n "${!name}" ]; then
configured+=("$name")
else
missing+=("$name")
fi
done
if [ "${#configured[@]}" -eq 0 ]; then
echo "$output_name=false" >> "$GITHUB_OUTPUT"
echo "::notice::$label code signing is disabled; installers will be published unsigned."
elif [ "${#missing[@]}" -ne 0 ]; then
echo "Optional $label signing credentials are incomplete: ${missing[*]}"
exit 1
else
echo "$output_name=true" >> "$GITHUB_OUTPUT"
fi
}
check_optional_signing \
"macOS" \
apple_signing_enabled \
APPLE_CERTIFICATE \
APPLE_CERTIFICATE_PASSWORD \
APPLE_SIGNING_IDENTITY \
APPLE_API_ISSUER \
APPLE_API_KEY \
APPLE_API_KEY_P8_BASE64
if [ -n "$EVSIGN_LICENSE_KEY" ]; then
echo "windows_signing_enabled=true" >> "$GITHUB_OUTPUT"
echo "windows_signing_method=evsign" >> "$GITHUB_OUTPUT"
else
check_optional_signing \
"Windows" \
windows_signing_enabled \
WINDOWS_CERTIFICATE \
WINDOWS_CERTIFICATE_PASSWORD
if [ -n "$WINDOWS_CERTIFICATE" ] && [ -n "$WINDOWS_CERTIFICATE_PASSWORD" ]; then
echo "windows_signing_method=pfx" >> "$GITHUB_OUTPUT"
else
echo "windows_signing_method=" >> "$GITHUB_OUTPUT"
fi
fi
- name: Create release if missing
env:
GH_TOKEN: ${{ github.token }}
RELEASE_REPOSITORY: ${{ github.repository }}
run: |
if gh release view "$RELEASE_TAG" --repo "$RELEASE_REPOSITORY" >/dev/null 2>&1; then
echo "Release $RELEASE_TAG already exists."
else
notes_path="docs/release/${RELEASE_TAG#v}.md"
if [ -f "$notes_path" ]; then
gh release create "$RELEASE_TAG" \
--repo "$RELEASE_REPOSITORY" \
--title "$RELEASE_TAG" \
--notes-file "$notes_path"
else
gh release create "$RELEASE_TAG" \
--repo "$RELEASE_REPOSITORY" \
--title "$RELEASE_TAG" \
--generate-notes
fi
fi
probe-runners:
name: Probe ${{ matrix.artifact_name }} runner
runs-on: ${{ matrix.runner }}
timeout-minutes: 15
strategy:
fail-fast: true
matrix:
include: &desktop-targets
- artifact_name: windows-x64
runner: windows-latest
target: x86_64-pc-windows-msvc
electron_flag: --win --x64
- artifact_name: windows-arm64
runner: windows-11-arm
target: aarch64-pc-windows-msvc
electron_flag: --win --arm64
- artifact_name: linux-x64
runner: ubuntu-22.04
target: x86_64-unknown-linux-gnu
electron_flag: --linux --x64
- artifact_name: linux-arm64
runner: ubuntu-22.04-arm
target: aarch64-unknown-linux-gnu
electron_flag: --linux --arm64
- artifact_name: macos-arm64
runner: macos-15
target: aarch64-apple-darwin
electron_flag: --mac --arm64
steps:
- name: Confirm runner
run: |
echo "runner=${{ matrix.runner }}"
echo "target=${{ matrix.target }}"
echo "electron_flag=${{ matrix.electron_flag }}"
echo "os=${{ runner.os }}"
echo "arch=${{ runner.arch }}"
build-frontend:
name: Build frontend
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Build frontend
env:
NODE_OPTIONS: --max-old-space-size=6144
run: pnpm run frontend:build
- name: Check frontend bundle budget
run: node frontend/scripts/check-bundle-budget.mjs
- name: Upload frontend artifact
uses: actions/upload-artifact@v4
with:
name: frontend-dist
path: frontend/dist
if-no-files-found: error
retention-days: 1
build:
name: Build ${{ matrix.artifact_name }}
needs: [prepare-release, build-frontend, probe-runners]
if: >-
!cancelled() &&
(needs.prepare-release.result == 'success' || needs.prepare-release.result == 'skipped') &&
needs.build-frontend.result == 'success' &&
needs.probe-runners.result == 'success'
runs-on: ${{ matrix.runner }}
env:
CARGO_INCREMENTAL: "0"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
SCCACHE_CACHE_SIZE: "10G"
SCCACHE_IDLE_TIMEOUT: "0"
DIMO_SKIP_FRONTEND_BUILD: "1"
strategy:
fail-fast: false
matrix:
include: *desktop-targets
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Install Linux desktop dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-0 \
libnss3 \
libasound2 \
xdg-utils \
xauth \
xvfb
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node
- name: Setup sccache
if: runner.os != 'Windows'
uses: BloopAI/sccache-action@main
- name: Disable sccache on Windows
if: runner.os == 'Windows'
shell: bash
run: |
echo "RUSTC_WRAPPER=" >> "$GITHUB_ENV"
echo "SCCACHE_GHA_ENABLED=false" >> "$GITHUB_ENV"
- name: Disable sccache on macOS
if: runner.os == 'macOS'
shell: bash
run: |
echo "RUSTC_WRAPPER=" >> "$GITHUB_ENV"
echo "SCCACHE_GHA_ENABLED=false" >> "$GITHUB_ENV"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
targets: ${{ matrix.target }}
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: "."
cache-provider: github
cache-on-failure: true
shared-key: desktop-electron-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target }}
cache-targets: false
- name: Install workspace dependencies
run: pnpm install --frozen-lockfile
- name: Download frontend artifact
uses: actions/download-artifact@v4
with:
name: frontend-dist
path: frontend/dist
- name: Build Rust desktop sidecars
run: cargo build --release --target ${{ matrix.target }} -p server --bin dimo-server -p dimo-mcp --bin dimo-mcp -p dimo-workflow-mcp --bin dimo-workflow-mcp
- name: Stage Electron sidecar binaries
run: node scripts/stage-host-sidecars.js --electron --target ${{ matrix.target }} --profile release
- name: Build Electron main and preload bundles
env:
NODE_OPTIONS: --max-old-space-size=6144
run: pnpm run electron:build
- name: Import macOS signing certificate and notarization key
if: ${{ runner.os == 'macOS' && needs.prepare-release.outputs.apple_signing_enabled == 'true' }}
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_P8_BASE64: ${{ secrets.APPLE_API_KEY_P8_BASE64 }}
run: |
certificate_path="$RUNNER_TEMP/dimo-release-certificate.p12"
keychain_path="$RUNNER_TEMP/dimo-release.keychain-db"
api_key_path="$RUNNER_TEMP/AuthKey_${{ secrets.APPLE_API_KEY }}.p8"
keychain_password="$(openssl rand -hex 24)"
printf '%s' "$APPLE_CERTIFICATE" | base64 --decode > "$certificate_path"
printf '%s' "$APPLE_API_KEY_P8_BASE64" | base64 --decode > "$api_key_path"
security create-keychain -p "$keychain_password" "$keychain_path"
security set-keychain-settings -lut 21600 "$keychain_path"
security unlock-keychain -p "$keychain_password" "$keychain_path"
security import "$certificate_path" \
-k "$keychain_path" \
-P "$APPLE_CERTIFICATE_PASSWORD" \
-T /usr/bin/codesign \
-T /usr/bin/security
security set-key-partition-list \
-S apple-tool:,apple:,codesign: \
-s \
-k "$keychain_password" \
"$keychain_path"
security list-keychains -d user -s "$keychain_path" login.keychain-db
security find-identity -v -p codesigning "$keychain_path"
apple_csc_name="${APPLE_SIGNING_IDENTITY#Developer ID Application: }"
printf 'APPLE_SIGNING_IDENTITY=%s\n' "$APPLE_SIGNING_IDENTITY" >> "$GITHUB_ENV"
printf 'APPLE_CSC_NAME=%s\n' "$apple_csc_name" >> "$GITHUB_ENV"
echo "APPLE_API_KEY_PATH=$api_key_path" >> "$GITHUB_ENV"
echo "DIMO_MACOS_KEYCHAIN=$keychain_path" >> "$GITHUB_ENV"
echo "CSC_KEYCHAIN=$keychain_path" >> "$GITHUB_ENV"
- name: Package Electron desktop installers
timeout-minutes: 140
shell: bash
env:
NODE_OPTIONS: --max-old-space-size=6144
CSC_NAME: ${{ runner.os == 'macOS' && needs.prepare-release.outputs.apple_signing_enabled == 'true' && env.APPLE_CSC_NAME || '' }}
CSC_KEYCHAIN: ${{ runner.os == 'macOS' && needs.prepare-release.outputs.apple_signing_enabled == 'true' && env.CSC_KEYCHAIN || '' }}
WIN_CSC_LINK: ${{ runner.os == 'Windows' && needs.prepare-release.outputs.windows_signing_method == 'pfx' && secrets.WINDOWS_CERTIFICATE || '' }}
WIN_CSC_KEY_PASSWORD: ${{ runner.os == 'Windows' && needs.prepare-release.outputs.windows_signing_method == 'pfx' && secrets.WINDOWS_CERTIFICATE_PASSWORD || '' }}
CSC_IDENTITY_AUTO_DISCOVERY: ${{ (runner.os == 'macOS' && needs.prepare-release.outputs.apple_signing_enabled == 'true') || (runner.os == 'Windows' && needs.prepare-release.outputs.windows_signing_method == 'pfx') }}
EVSIGN_LICENSE_KEY: ${{ runner.os == 'Windows' && needs.prepare-release.outputs.windows_signing_method == 'evsign' && secrets.EVSIGN_LICENSE_KEY || '' }}
EVSIGN_SIGN_PASSWORD: ${{ runner.os == 'Windows' && needs.prepare-release.outputs.windows_signing_method == 'evsign' && secrets.EVSIGN_SIGN_PASSWORD || '' }}
EVSIGN_PUBLISHER_NAME: ${{ runner.os == 'Windows' && needs.prepare-release.outputs.windows_signing_method == 'evsign' && (vars.EVSIGN_PUBLISHER_NAME || secrets.EVSIGN_PUBLISHER_NAME) || '' }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY_PATH: ${{ env.APPLE_API_KEY_PATH }}
APPLE_SIGNING_IDENTITY: ${{ env.APPLE_SIGNING_IDENTITY }}
run: |
for var in CSC_NAME CSC_KEYCHAIN CSC_LINK CSC_KEY_PASSWORD WIN_CSC_LINK WIN_CSC_KEY_PASSWORD EVSIGN_LICENSE_KEY EVSIGN_SIGN_PASSWORD EVSIGN_PUBLISHER_NAME APPLE_API_KEY APPLE_API_ISSUER APPLE_API_KEY_PATH APPLE_SIGNING_IDENTITY; do
if [ -z "${!var:-}" ]; then
unset "$var"
fi
done
pnpm --filter @dimo/electron exec electron-builder ${{ matrix.electron_flag }} --config electron-builder.yml --publish never
- name: Sign Windows bridge payload with Tauri updater key
if: runner.os == 'Windows'
shell: pwsh
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
$installers = Get-ChildItem "electron/release" -File -Filter "*-setup.exe"
if ($installers.Count -ne 1) {
throw "Expected one NSIS installer under electron/release, found $($installers.Count)"
}
& pnpm dlx @tauri-apps/cli@2.10.0 signer sign $installers[0].FullName
if ($LASTEXITCODE -ne 0) {
throw "Failed to generate Tauri bridge .sig for $($installers[0].Name)"
}
- name: Sign Linux bridge payload with Tauri updater key
if: runner.os == 'Linux'
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
appimage="$(find "electron/release" -maxdepth 1 -name '*.AppImage' -print -quit)"
test -n "$appimage"
pnpm dlx @tauri-apps/cli@2.10.0 signer sign "$appimage"
- name: Notarize macOS DMG and create signed Tauri bridge tarball
if: runner.os == 'macOS'
timeout-minutes: 60
env:
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY_PATH: ${{ env.APPLE_API_KEY_PATH }}
APPLE_SIGNING_IDENTITY: ${{ env.APPLE_SIGNING_IDENTITY }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
set -euo pipefail
version="$(node -p "require('./package.json').version")"
app_path="$(find "electron/release/mac-arm64" -maxdepth 1 -name '*.app' -print -quit)"
test -n "$app_path"
app_name="$(basename "$app_path")"
tar_path="electron/release/Dimo-${version}-darwin-arm64.app.tar.gz"
if [ "${{ needs.prepare-release.outputs.apple_signing_enabled }}" = "true" ]; then
dmg_path="$(find "electron/release" -maxdepth 1 -name '*.dmg' -print -quit)"
test -n "$dmg_path"
codesign --force --timestamp --sign "$APPLE_SIGNING_IDENTITY" "$dmg_path"
xcrun notarytool submit "$dmg_path" \
--key "$APPLE_API_KEY_PATH" \
--key-id "$APPLE_API_KEY" \
--issuer "$APPLE_API_ISSUER" \
--wait
xcrun stapler staple "$dmg_path"
# Signing and stapling mutate the DMG bytes, invalidating the
# pre-sign blockmap produced by electron-builder.
rm -f "${dmg_path}.blockmap"
fi
tar -czf "$tar_path" -C "electron/release/mac-arm64" "$app_name"
pnpm dlx @tauri-apps/cli@2.10.0 signer sign "$tar_path"
- name: Verify signed and notarized macOS bundle
if: ${{ runner.os == 'macOS' && needs.prepare-release.outputs.apple_signing_enabled == 'true' }}
run: |
set -euo pipefail
mount_dir=""
extract_dir=""
cleanup_verify() {
if [ -n "$mount_dir" ]; then
hdiutil detach "$mount_dir" -force >/dev/null 2>&1 || true
rm -rf "$mount_dir"
fi
if [ -n "$extract_dir" ]; then
rm -rf "$extract_dir"
fi
}
trap cleanup_verify EXIT
app_path="$(find "electron/release/mac-arm64" -maxdepth 1 -name '*.app' -print -quit)"
test -n "$app_path"
codesign --verify --deep --strict --verbose=2 "$app_path"
xcrun stapler validate -v "$app_path"
spctl --assess --type execute --verbose=2 "$app_path"
dmg_path="$(find "electron/release" -maxdepth 1 -name '*.dmg' -print -quit)"
test -n "$dmg_path"
codesign --verify --verbose=2 "$dmg_path"
xcrun stapler validate -v "$dmg_path"
spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg_path"
mount_dir="$(mktemp -d "${RUNNER_TEMP:-/tmp}/dimo-dmg-verify.XXXXXX")"
hdiutil attach -readonly -nobrowse -mountpoint "$mount_dir" "$dmg_path"
dmg_app_path="$(find "$mount_dir" -maxdepth 1 -name '*.app' -print -quit)"
test -n "$dmg_app_path"
codesign --verify --deep --strict --verbose=2 "$dmg_app_path"
xcrun stapler validate -v "$dmg_app_path"
spctl --assess --type execute --verbose=2 "$dmg_app_path"
hdiutil detach "$mount_dir"
rm -rf "$mount_dir"
mount_dir=""
tar_path="$(find "electron/release" -maxdepth 1 -name '*.app.tar.gz' -print -quit)"
test -n "$tar_path"
test -s "${tar_path}.sig"
extract_dir="$(mktemp -d "${RUNNER_TEMP:-/tmp}/dimo-updater-verify.XXXXXX")"
tar -xzf "$tar_path" -C "$extract_dir"
tar_app_path="$(find "$extract_dir" -maxdepth 1 -name '*.app' -print -quit)"
test -n "$tar_app_path"
codesign --verify --deep --strict --verbose=2 "$tar_app_path"
xcrun stapler validate -v "$tar_app_path"
spctl --assess --type execute --verbose=2 "$tar_app_path"
- name: Verify signed Windows artifacts
if: ${{ runner.os == 'Windows' && needs.prepare-release.outputs.windows_signing_enabled == 'true' }}
shell: pwsh
env:
WINDOWS_SIGNING_METHOD: ${{ needs.prepare-release.outputs.windows_signing_method }}
EVSIGN_PUBLISHER_NAME: ${{ vars.EVSIGN_PUBLISHER_NAME || secrets.EVSIGN_PUBLISHER_NAME }}
run: |
$errors = [System.Collections.Generic.List[string]]::new()
$verifyInnerSignatures = ($env:WINDOWS_SIGNING_METHOD -eq 'pfx')
$requirePublisherName = ($env:WINDOWS_SIGNING_METHOD -eq 'pfx') -or (-not [string]::IsNullOrWhiteSpace($env:EVSIGN_PUBLISHER_NAME))
$artifacts = @(Get-ChildItem "electron/release" -File |
Where-Object { $_.Extension -in '.exe', '.msi' })
if ($artifacts.Count -eq 0) {
throw 'No Windows installers were produced.'
}
foreach ($artifact in $artifacts) {
$signature = Get-AuthenticodeSignature -LiteralPath $artifact.FullName
if ($signature.Status -ne 'Valid') {
$errors.Add("Invalid Authenticode signature for $($artifact.FullName): $($signature.Status)")
}
}
$installer = $artifacts | Where-Object { $_.Name -like '*-setup.exe' } | Select-Object -First 1
if (-not $installer) {
$errors.Add('Expected a signed *-setup.exe NSIS installer under electron/release.')
} else {
$blockmapPath = "$($installer.FullName).blockmap"
if (-not (Test-Path -LiteralPath $blockmapPath -PathType Leaf) -or (Get-Item -LiteralPath $blockmapPath).Length -le 0) {
$errors.Add("Missing or empty differential update blockmap: $blockmapPath")
}
$latestYmlPath = Join-Path "electron/release" "latest.yml"
if (-not (Test-Path -LiteralPath $latestYmlPath -PathType Leaf)) {
$errors.Add("Missing electron-builder feed: $latestYmlPath")
} else {
$sha512 = [System.Security.Cryptography.SHA512]::Create()
try {
$stream = [System.IO.File]::OpenRead($installer.FullName)
try {
$expectedSha512 = [Convert]::ToBase64String($sha512.ComputeHash($stream))
} finally {
$stream.Dispose()
}
} finally {
$sha512.Dispose()
}
$latestYml = Get-Content -LiteralPath $latestYmlPath -Raw
if (-not $latestYml.Contains("sha512: $expectedSha512")) {
$errors.Add("latest.yml sha512 does not match signed installer $($installer.Name)")
}
if (-not $latestYml.Contains("size: $($installer.Length)")) {
$errors.Add("latest.yml size does not match signed installer $($installer.Name)")
}
}
}
$unpacked = Get-ChildItem "electron/release" -Directory -Filter "win*-unpacked" | Select-Object -First 1
if (-not $unpacked) {
$errors.Add('Missing Electron unpacked directory under electron/release.')
} else {
$innerExes = @(
(Join-Path $unpacked.FullName 'Dimo.exe'),
(Join-Path $unpacked.FullName 'resources\bin\dimo-server.exe'),
(Join-Path $unpacked.FullName 'resources\bin\dimo-mcp.exe'),
(Join-Path $unpacked.FullName 'resources\bin\dimo-workflow-mcp.exe')
)
foreach ($exePath in $innerExes) {
if (-not (Test-Path -LiteralPath $exePath -PathType Leaf)) {
$errors.Add("Missing packaged Windows executable: $exePath")
continue
}
if ($verifyInnerSignatures) {
$innerSig = Get-AuthenticodeSignature -LiteralPath $exePath
if ($innerSig.Status -ne 'Valid') {
$errors.Add("Invalid Authenticode signature for packaged executable ${exePath}: $($innerSig.Status)")
}
}
}
$appUpdatePath = Join-Path $unpacked.FullName 'resources\app-update.yml'
if (-not (Test-Path -LiteralPath $appUpdatePath -PathType Leaf)) {
$errors.Add("Missing updater config: $appUpdatePath")
} elseif ($requirePublisherName) {
$appUpdateYml = Get-Content -LiteralPath $appUpdatePath -Raw
if ($appUpdateYml -notmatch '(?m)^\s*publisherName\s*:\s*(\S+|\r?\n\s*-\s*\S+)') {
$errors.Add('app-update.yml is missing publisherName; NsisUpdater would skip signature verification.')
}
}
}
if ($errors.Count -gt 0) {
throw ("Windows signing verification failed:`n - " + ($errors -join "`n - "))
}
Write-Host "Verified signed Windows installer, packaged executables, blockmap, and latest.yml hashes (method: $($env:WINDOWS_SIGNING_METHOD))."
- name: Smoke-test Linux desktop startup through Xvfb
if: runner.os == 'Linux'
run: |
unpacked_dir="$(find "electron/release" -maxdepth 1 -type d -name 'linux*-unpacked' -print -quit)"
test -n "$unpacked_dir"
DIMO_ELECTRON_SMOKE=1 scripts/smoke-linux-desktop.sh "$unpacked_dir/dimo"
- name: Smoke-test macOS desktop startup
if: runner.os == 'macOS'
timeout-minutes: 2
run: |
app_path="$(find "electron/release/mac-arm64" -maxdepth 1 -name '*.app' -print -quit)"
test -n "$app_path"
DIMO_ELECTRON_SMOKE=1 scripts/smoke-macos-desktop.sh "$app_path"
if [ "${{ needs.prepare-release.outputs.apple_signing_enabled }}" = "true" ]; then
codesign --verify --deep --strict --verbose=2 "$app_path"
fi
- name: Smoke-test Windows desktop startup without a console
if: runner.os == 'Windows'
shell: pwsh
run: |
$unpacked = Get-ChildItem "electron/release" -Directory -Filter "win*-unpacked" | Select-Object -First 1
if (-not $unpacked) {
throw "Missing Electron unpacked directory under electron/release"
}
$exe = Join-Path $unpacked.FullName "Dimo.exe"
scripts/smoke-windows-desktop.ps1 -Executable $exe -ElectronSmoke
- name: Remove temporary macOS signing material
if: ${{ always() && runner.os == 'macOS' && needs.prepare-release.outputs.apple_signing_enabled == 'true' }}
env:
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
run: |
security delete-keychain "$RUNNER_TEMP/dimo-release.keychain-db" || true
rm -f \
"$RUNNER_TEMP/dimo-release-certificate.p12" \
"$RUNNER_TEMP/AuthKey_${APPLE_API_KEY}.p8"
- name: Remove temporary Windows EVSign CLI
if: ${{ always() && runner.os == 'Windows' && needs.prepare-release.outputs.windows_signing_method == 'evsign' }}
shell: pwsh
run: |
if ($env:RUNNER_TEMP) {
Remove-Item -LiteralPath (Join-Path $env:RUNNER_TEMP 'evsign-client.exe') -Force -ErrorAction SilentlyContinue
}
- name: Upload workflow artifact
uses: actions/upload-artifact@v4
with:
name: Dimo-${{ matrix.artifact_name }}
if-no-files-found: error
path: |
electron/release/*.exe
electron/release/*.exe.blockmap
electron/release/*.exe.sig
electron/release/*.AppImage
electron/release/*.AppImage.sig
electron/release/*.deb
electron/release/*.dmg
electron/release/*.dmg.blockmap
electron/release/*.zip
electron/release/*.zip.blockmap
electron/release/*.app.tar.gz
electron/release/*.app.tar.gz.sig
electron/release/latest*.yml
publish-updater:
name: Publish updater feeds & bridge manifest
needs: build
if: ${{ github.event_name == 'push' || (inputs.upload_to_release && inputs.release_tag != '') }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Download desktop build artifacts
uses: actions/download-artifact@v4
with:
pattern: Dimo-*
path: updater-artifacts
- name: Generate Electron updater feeds and Tauri bridge manifest
env:
RELEASE_REPOSITORY: ${{ github.repository }}
run: |
VERSION="$(node -p "require('./package.json').version")"
NOTES_FILE="docs/release/${RELEASE_TAG#v}.md"
NOTES_ARGS=()
if [ -f "$NOTES_FILE" ]; then
NOTES_ARGS=(--notes-file "$NOTES_FILE")
fi
node scripts/generate-tauri-bridge-manifest.js \
--artifacts-dir updater-artifacts \
--output-dir updater-release \
--repository "$RELEASE_REPOSITORY" \
--release-tag "$RELEASE_TAG" \
--version "$VERSION" \
"${NOTES_ARGS[@]}"
- name: Upload updater feeds, bridge manifest, and signed bundles
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
shopt -s nullglob
files=(updater-release/*)
if [ "${#files[@]}" -eq 0 ]; then
echo "no updater-release files"
exit 1
fi
for file in "${files[@]}"; do
name="$(basename "$file")"
attempt=1
until gh release upload "$RELEASE_TAG" "$file" --clobber; do
if [ "$attempt" -ge 8 ]; then
echo "failed to upload $name after $attempt attempts"
exit 1
fi
echo "retry $attempt for $name"
attempt=$((attempt + 1))
sleep $((attempt * 15))
done
echo "uploaded $name"
done
- name: Mark desktop release as latest
env:
GH_TOKEN: ${{ github.token }}
run: gh release edit "$RELEASE_TAG" --draft=false --prerelease=false --latest