-
Notifications
You must be signed in to change notification settings - Fork 5.5k
1868 lines (1697 loc) · 85.5 KB
/
release-electrobun.yml
File metadata and controls
1868 lines (1697 loc) · 85.5 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
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Build & Release — Electrobun desktop app (signed/notarized on macOS, CEF on Windows/Linux)
# Produces installer artifacts plus platform-prefixed .tar.zst/*-update.json
# update channel files.
#
# Path notes for eliza-native port:
# - The Electrobun shell lives at `packages/app-core/platforms/electrobun/`
# in eliza (not `packages/app/electrobun/` — that directory only carries a
# .gitignore stub). All build artifacts, scripts, and signing helpers live
# under that platforms/electrobun/ path.
# - Helper scripts that did not exist in upstream eliza (ensure-electrobun-core.mjs,
# ensure-legacy-electrobun-compat.mjs, patch-release-check-pack-fallback.mjs)
# have been removed; the corresponding caching/preflight steps are dropped
# and surfaced as TODOs so the user can port them if needed.
#
# Required GitHub Secrets (macOS signing + notarization):
# CSC_LINK – base64-encoded Developer ID Application .p12
# CSC_KEY_PASSWORD – password for the .p12 certificate
# APPLE_ID – Apple ID email for notarization
# APPLE_APP_SPECIFIC_PASSWORD – app-specific password from appleid.apple.com
# APPLE_TEAM_ID – 10-char Apple Developer Team ID
#
# Configure on elizaOS/eliza repo settings:
# WINDOWS_SIGN_CERT_BASE64, WINDOWS_SIGN_CERT_PASSWORD, WINDOWS_SIGN_TIMESTAMP_URL
# ANTHROPIC_API_KEY (used by Windows packaged smoke test as the boot AI provider)
# ELIZAOS_CLOUD_API_KEY / ELIZACLOUD_API_KEY / ELIZAOS_CLOUD_BASE_URL (optional cloud regression)
#
# Optional release-host upload secrets:
# RELEASE_UPLOAD_KEY – SSH private key for releases server
# RELEASE_HOST_FINGERPRINT – pinned SSH host key entry for releases host
name: Build & Release (Electrobun)
on:
push:
tags:
- "v*"
workflow_call:
inputs:
tag:
description: "Release tag override (e.g. v2.0.0-beta.0)"
required: false
type: string
draft:
description: "Create the GitHub release as a draft"
required: false
type: boolean
default: false
publish_release:
description: "Create the GitHub release and upload updater files"
required: false
type: boolean
default: false
platform:
description: "Desktop platform matrix to build (all, windows, macos, linux)"
required: false
type: string
default: "all"
workflow_dispatch:
inputs:
tag:
description: "Release tag (e.g. v2.0.0-beta.0)"
required: false
type: string
draft:
description: "Create as draft release"
required: false
type: boolean
default: true
platform:
description: "Desktop platform matrix to build"
required: false
type: choice
default: "all"
options:
- all
- windows
- macos
- linux
concurrency:
group: release-electrobun-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
env:
CI: "true"
BUN_VERSION: "1.3.13" # 1.3.13 is the verified desktop packaging runtime; 1.3.11 trips Electrobun bundle creation in CI.
jobs:
prepare:
name: Prepare Release
if: >-
${{
github.event_name != 'push' ||
(
!contains(github.ref_name, '-')
)
}}
runs-on: ${{ vars.RUNNER_UBUNTU || 'ubuntu-24.04' }}
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
env: ${{ steps.version.outputs.env }}
source_sha: ${{ steps.version.outputs.source_sha }}
desktop_matrix: ${{ steps.desktop-matrix.outputs.desktop_matrix }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: false
- name: Determine version + env
id: version
run: |
if [[ -n "${{ inputs.tag }}" ]]; then
TAG="${{ inputs.tag }}"
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG="${{ github.ref_name }}"
else
echo "Manual branch dispatches must provide inputs.tag; refusing to derive a release tag from package.json." >&2
exit 1
fi
VERSION="${TAG#v}"
# canary for pre-release tags, stable for everything else
if [[ "$VERSION" == *"-"* ]]; then
BUILD_ENV="canary"
else
BUILD_ENV="stable"
fi
{
echo "tag=$TAG"
echo "version=$VERSION"
echo "env=$BUILD_ENV"
echo "source_sha=$GITHUB_SHA"
} >> "$GITHUB_OUTPUT"
echo "Release: $VERSION (tag: $TAG, env: $BUILD_ENV, sha: $GITHUB_SHA)"
- name: Select desktop platform matrix
id: desktop-matrix
env:
RELEASE_PLATFORM: ${{ inputs.platform || 'all' }}
run: |
case "$RELEASE_PLATFORM" in
""|all)
printf '%s\n' '{"platform":[{"name":"macOS (Apple Silicon)","os":"macos","runner":"macos-14","artifact-name":"macos-arm64"},{"name":"macOS (Intel)","os":"macos","runner":"macos-15-intel","artifact-name":"macos-x64"},{"name":"Windows","os":"windows","runner":"${{ vars.RUNNER_WINDOWS || 'windows-2025' }}","artifact-name":"windows-x64"},{"name":"Linux","os":"linux","runner":"ubuntu-latest","artifact-name":"linux-x64"}]}' > "$RUNNER_TEMP/desktop-matrix.json"
;;
windows)
printf '%s\n' '{"platform":[{"name":"Windows","os":"windows","runner":"${{ vars.RUNNER_WINDOWS || 'windows-2025' }}","artifact-name":"windows-x64"}]}' > "$RUNNER_TEMP/desktop-matrix.json"
;;
macos)
printf '%s\n' '{"platform":[{"name":"macOS (Apple Silicon)","os":"macos","runner":"macos-14","artifact-name":"macos-arm64"},{"name":"macOS (Intel)","os":"macos","runner":"macos-15-intel","artifact-name":"macos-x64"}]}' > "$RUNNER_TEMP/desktop-matrix.json"
;;
linux)
printf '%s\n' '{"platform":[{"name":"Linux","os":"linux","runner":"ubuntu-latest","artifact-name":"linux-x64"}]}' > "$RUNNER_TEMP/desktop-matrix.json"
;;
*)
echo "::error::Unsupported desktop release platform: $RELEASE_PLATFORM"
exit 1
;;
esac
echo "desktop_matrix=$(tr -d '\n' < "$RUNNER_TEMP/desktop-matrix.json")" >> "$GITHUB_OUTPUT"
cat "$RUNNER_TEMP/desktop-matrix.json"
validate-release:
name: Validate Release Inputs
if: ${{ inputs.platform != 'windows' }}
needs: prepare
runs-on: ${{ vars.RUNNER_UBUNTU || 'ubuntu-24.04' }}
env:
NODE_NO_WARNINGS: "1"
defaults:
run:
shell: bash -euo pipefail {0}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Setup Bun workspace
uses: ./.github/actions/setup-bun-workspace
with:
bun-version: ${{ env.BUN_VERSION }}
install-command: bun install --ignore-scripts
install-native-deps: "true"
run-postinstall: "true"
init-submodules: "false"
# TODO: verify this script exists in eliza or port equivalent.
# In eliza this was `bun run test:regression-matrix:release`.
- name: Regression matrix contract
run: bun run test:regression-matrix:release
- name: Prepare Whisper model artifact
run: |
bash packages/app-core/platforms/electrobun/scripts/ensure-whisper-model.sh base.en
mkdir -p .artifacts/whisper-model
cp "$HOME/.cache/eliza/whisper/ggml-base.en.bin" .artifacts/whisper-model/ggml-base.en.bin
- name: Upload Whisper model artifact
uses: actions/upload-artifact@v7
with:
name: whisper-model-base-en
path: .artifacts/whisper-model/ggml-base.en.bin
if-no-files-found: error
- name: Align version with release tag
run: |
node packages/app-core/scripts/align-electrobun-version.mjs
node <<'NODE'
const fs = require("node:fs");
const version = process.env.RELEASE_VERSION;
const packagePath = "packages/app-core/platforms/electrobun/package.json";
const configPath = "packages/app-core/platforms/electrobun/electrobun.config.ts";
const pkg = JSON.parse(fs.readFileSync(packagePath, "utf8"));
pkg.version = version;
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + "\n");
let config = fs.readFileSync(configPath, "utf8");
config = config.replace(/version:\s*"[^"]+"/, `version: "${version}"`);
fs.writeFileSync(configPath, config);
NODE
env:
RELEASE_VERSION: ${{ needs.prepare.outputs.version }}
- name: Ensure avatar assets
run: node packages/app-core/scripts/ensure-avatars.mjs
- name: Build core dist (server bundle)
run: |
node --input-type=module <<'NODE'
import fs from "node:fs";
import path from "node:path";
const root = process.cwd();
const hasRootTsdownEntry =
fs.existsSync(path.join(root, "tsdown.config.ts")) ||
fs.existsSync(path.join(root, "tsdown.config.mts")) ||
fs.existsSync(path.join(root, "tsdown.config.js")) ||
fs.existsSync(path.join(root, "src", "index.ts"));
if (hasRootTsdownEntry) {
const { spawnSync } = await import("node:child_process");
const result = spawnSync("bunx", ["tsdown", "--fail-on-warn", "false"], {
cwd: root,
stdio: "inherit",
shell: process.platform === "win32",
});
process.exit(result.status ?? 1);
}
const entryTarget = "../packages/app-core/src/entry.ts";
const entrySource = [
"// auto-generated by release-electrobun.yml",
"// Standalone elizaOS checkouts do not have a root tsdown entry.",
`export * from ${JSON.stringify(entryTarget)};`,
"",
].join("\n");
fs.mkdirSync(path.join(root, "dist"), { recursive: true });
fs.writeFileSync(path.join(root, "dist", "entry.js"), entrySource);
fs.writeFileSync(path.join(root, "dist", "index.js"), entrySource);
fs.writeFileSync(path.join(root, "dist", "package.json"), '{"type":"module"}\n');
NODE
node --import tsx packages/scripts/write-build-info.ts
- name: Run heavy E2E regression suite
# TODO: verify this target exists in eliza root package.json.
run: bun run test:e2e:heavy
- name: Probe optional cloud live regression key
id: probe-cloud-live-key
env:
ELIZAOS_CLOUD_API_KEY: ${{ secrets.ELIZAOS_CLOUD_API_KEY != '' && secrets.ELIZAOS_CLOUD_API_KEY || secrets.ELIZACLOUD_API_KEY }}
run: |
if [ -n "${ELIZAOS_CLOUD_API_KEY:-}" ]; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "::warning::No Eliza Cloud API key configured for release validation - skipping optional cloud live regression."
echo "available=false" >> "$GITHUB_OUTPUT"
fi
- name: Run optional cloud live regression suite
if: steps.probe-cloud-live-key.outputs.available == 'true'
shell: bash
run: |
set -o pipefail
log_file="$(mktemp)"
if bun run test:live:cloud 2>&1 | tee "$log_file"; then
exit 0
fi
echo "::warning::Optional cloud live regression failed; release validation continues with deterministic build and packaging checks."
exit 0
env:
ELIZA_LIVE_TEST: "1"
ELIZAOS_CLOUD_API_KEY: ${{ secrets.ELIZAOS_CLOUD_API_KEY != '' && secrets.ELIZAOS_CLOUD_API_KEY || secrets.ELIZACLOUD_API_KEY }}
ELIZAOS_CLOUD_BASE_URL: ${{ secrets.ELIZAOS_CLOUD_BASE_URL }}
- name: Restore build metadata after test rebuilds
run: node --import tsx packages/scripts/write-build-info.ts
- name: Generate release validation manifests
run: |
node packages/app-core/scripts/write-homepage-release-data.mjs
node packages/app-core/scripts/generate-static-asset-manifest.mjs
- name: Release readiness checks
env:
ELIZA_RELEASE_TAG: ${{ needs.prepare.outputs.tag }}
ELIZA_CDN_VALIDATION_REF: ${{ github.sha }}
ELIZA_VALIDATE_CDN: "1"
run: bun run release:check
build-browser-companions:
name: Build Agent Browser Bridge companions
if: ${{ inputs.platform == '' || inputs.platform == 'all' }}
needs: [prepare, validate-release]
runs-on: macos-15
timeout-minutes: 60
outputs:
packaged: ${{ steps.package-browser-bridge.outputs.packaged }}
defaults:
run:
shell: bash -euo pipefail {0}
env:
ELIZA_RELEASE_TAG: ${{ needs.prepare.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Setup Bun workspace
uses: ./.github/actions/setup-bun-workspace
with:
bun-version: ${{ env.BUN_VERSION }}
install-command: bun install --ignore-scripts
install-native-deps: "false"
run-postinstall: "true"
init-submodules: "false"
- name: Package Agent Browser Bridge release bundles
id: package-browser-bridge
run: |
if bun run browser-bridge:package:release; then
echo "packaged=true" >> "$GITHUB_OUTPUT"
else
echo "::warning::Agent Browser Bridge packaging failed; desktop release will continue without browser companion bundles."
echo "packaged=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload Agent Browser Bridge release artifacts
if: steps.package-browser-bridge.outputs.packaged == 'true'
uses: actions/upload-artifact@v7
with:
name: browser-bridge-store-bundles
path: |
packages/browser-bridge-extension/dist/artifacts/browser-bridge-chrome-v*.zip
packages/browser-bridge-extension/dist/artifacts/browser-bridge-safari-v*.zip
packages/browser-bridge-extension/dist/artifacts/browser-bridge-safari-project-v*.zip
packages/browser-bridge-extension/dist/artifacts/browser-bridge-release-manifest-v*.json
if-no-files-found: error
retention-days: 30
build:
name: Build ${{ matrix.platform.name }}
if: ${{ always() && needs.prepare.result == 'success' && (needs.validate-release.result == 'success' || needs.validate-release.result == 'skipped') }}
needs: [prepare, validate-release]
runs-on: ${{ matrix.platform.runner }}
timeout-minutes: 150
defaults:
run:
shell: bash -euo pipefail {0}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.desktop_matrix) }}
steps:
- name: Enable Git long paths (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
function Set-GitLongPaths([string]$Scope) {
& git config $Scope core.longpaths true
if ($LASTEXITCODE -ne 0) {
throw "git config $Scope core.longpaths true failed with exit code $LASTEXITCODE"
}
}
try {
Set-GitLongPaths "--system"
Write-Host "Enabled Git long paths in system config."
} catch {
Write-Warning "System git config failed; falling back to --global. $($_.Exception.Message)"
Set-GitLongPaths "--global"
Write-Host "Enabled Git long paths in global config."
}
- name: Checkout
uses: actions/checkout@v6
with:
submodules: false
- name: Validate public desktop signing inputs
env:
BUILD_ENV: ${{ needs.prepare.outputs.env }}
PUBLISH_RELEASE: ${{ inputs.publish_release || github.event_name == 'push' }}
PLATFORM_OS: ${{ matrix.platform.os }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
WINDOWS_SIGN_CERT_BASE64: ${{ secrets.WINDOWS_SIGN_CERT_BASE64 }}
WINDOWS_SIGN_CERT_PASSWORD: ${{ secrets.WINDOWS_SIGN_CERT_PASSWORD }}
WINDOWS_SIGN_TIMESTAMP_URL: ${{ secrets.WINDOWS_SIGN_TIMESTAMP_URL }}
run: |
if [[ "$PUBLISH_RELEASE" != "true" && "$BUILD_ENV" != "stable" ]]; then
echo "Non-published canary build; signing inputs are advisory."
exit 0
fi
missing=()
case "$PLATFORM_OS" in
macos)
[[ -z "$CSC_LINK" ]] && missing+=("CSC_LINK")
[[ -z "$CSC_KEY_PASSWORD" ]] && missing+=("CSC_KEY_PASSWORD")
[[ -z "$APPLE_ID" ]] && missing+=("APPLE_ID")
[[ -z "$APPLE_APP_SPECIFIC_PASSWORD" ]] && missing+=("APPLE_APP_SPECIFIC_PASSWORD")
[[ -z "$APPLE_TEAM_ID" ]] && missing+=("APPLE_TEAM_ID")
;;
windows)
[[ -z "$WINDOWS_SIGN_CERT_BASE64" ]] && missing+=("WINDOWS_SIGN_CERT_BASE64")
[[ -z "$WINDOWS_SIGN_CERT_PASSWORD" ]] && missing+=("WINDOWS_SIGN_CERT_PASSWORD")
[[ -z "$WINDOWS_SIGN_TIMESTAMP_URL" ]] && missing+=("WINDOWS_SIGN_TIMESTAMP_URL")
;;
esac
if [[ ${#missing[@]} -gt 0 ]]; then
echo "::error::Missing public desktop signing inputs for $PLATFORM_OS: ${missing[*]}"
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install Linux packaging tools
if: matrix.platform.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
curl \
desktop-file-utils \
file \
rpm
- name: Install root dependencies
# --ignore-scripts skips native dependency install scripts (e.g. @tensorflow/tfjs-node
# which has no pre-built binary for Node 22 on Windows and fails to compile).
# Workspace prepare scripts are NOT suppressed by --ignore-scripts in bun.
# macOS Intel: keep the x64 invocation explicit in case the runner image
# ships with dual-arch shims.
run: |
if [ "${{ matrix.platform.os }}" = "macos" ] && [ "${{ matrix.platform.artifact-name }}" = "macos-x64" ]; then
install_cmd=(arch -x86_64 bun install --ignore-scripts)
else
install_cmd=(bun install --ignore-scripts)
fi
for attempt in 1 2 3; do
if "${install_cmd[@]}"; then
exit 0
fi
if [ "$attempt" -eq 3 ]; then
echo "bun install failed after ${attempt} attempts" >&2
exit 1
fi
echo "bun install failed on attempt ${attempt}; retrying in 15 seconds" >&2
sleep 15
done
- name: Run repository postinstall patches
run: bun run postinstall
- name: Align version with release tag
run: |
node packages/app-core/scripts/align-electrobun-version.mjs
node <<'NODE'
const fs = require("node:fs");
const version = process.env.RELEASE_VERSION;
const packagePath = "packages/app-core/platforms/electrobun/package.json";
const configPath = "packages/app-core/platforms/electrobun/electrobun.config.ts";
const pkg = JSON.parse(fs.readFileSync(packagePath, "utf8"));
pkg.version = version;
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + "\n");
let config = fs.readFileSync(configPath, "utf8");
config = config.replace(/version:\s*"[^"]+"/, `version: "${version}"`);
fs.writeFileSync(configPath, config);
NODE
env:
RELEASE_VERSION: ${{ needs.prepare.outputs.version }}
- name: Generate i18n keyword data
run: |
node packages/shared/scripts/generate-keywords.mjs --target ts
test -f packages/shared/src/i18n/generated/validation-keyword-data.js
- name: Stage desktop bundle inputs
run: |
if [ "${{ matrix.platform.os }}" = "macos" ] && [ "${{ matrix.platform.artifact-name }}" = "macos-x64" ]; then
ELIZA_DESKTOP_COMMAND_PREFIX="arch -x86_64" node packages/app-core/scripts/desktop-build.mjs stage --variant=base
else
node packages/app-core/scripts/desktop-build.mjs stage --variant=base
fi
mkdir -p dist/node_modules/@elizaos/shared/src/i18n/generated
cp packages/shared/src/i18n/generated/validation-keyword-data.ts dist/node_modules/@elizaos/shared/src/i18n/generated/
cp packages/shared/src/i18n/generated/validation-keyword-data.js dist/node_modules/@elizaos/shared/src/i18n/generated/
test -f dist/node_modules/@elizaos/shared/src/i18n/generated/validation-keyword-data.js
- name: Validate Electrobun runtime copy contract
env:
ELIZA_ELECTROBUN_REPO_ROOT: ${{ github.workspace }}
run: |
test -f dist/entry.js
test -f package.json
test -f dist/node_modules/@elizaos/agent/package.json
test -f dist/node_modules/@elizaos/shared/src/i18n/generated/validation-keyword-data.js
node --import tsx <<'NODE'
const path = await import("node:path");
const configModule = await import("./packages/app-core/platforms/electrobun/electrobun.config.ts");
const config = configModule.default?.default ?? configModule.default;
const electrobunDir = path.resolve("packages/app-core/platforms/electrobun");
const copyMap = config.build?.copy ?? {};
const runtimeSource = Object.entries(copyMap).find(
([, destination]) => destination === "eliza-dist",
)?.[0];
if (!runtimeSource) {
throw new Error("Electrobun copy map does not include eliza-dist runtime destination");
}
const resolvedRuntimeSource = path.resolve(electrobunDir, runtimeSource);
const expectedRuntimeSource = path.resolve("dist");
if (resolvedRuntimeSource !== expectedRuntimeSource) {
throw new Error(
`Electrobun runtime source resolves to ${resolvedRuntimeSource}, expected ${expectedRuntimeSource}`,
);
}
NODE
# Import the Developer ID certificate into a temporary keychain.
# Requires CSC_LINK (base64-encoded .p12) + CSC_KEY_PASSWORD.
# The signing identity string is extracted and passed to Electrobun as
# ELECTROBUN_DEVELOPER_ID in the build step below.
- name: Set up macOS signing keychain
if: matrix.platform.os == 'macos'
id: macos-keychain
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
run: |
if [ -z "$CSC_LINK" ]; then
echo "::warning::CSC_LINK not set — building unsigned (no codesign/notarize)"
echo "skip_codesign=1" >> "$GITHUB_OUTPUT"
exit 0
fi
KEYCHAIN_PATH="$RUNNER_TEMP/eliza-signing.keychain-db"
KEYCHAIN_PASSWORD="$(openssl rand -base64 32)"
# Create a short-lived keychain for this build
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Decode and import the .p12 certificate
CERT_PATH="$RUNNER_TEMP/cert.p12"
echo "$CSC_LINK" | base64 --decode > "$CERT_PATH"
security import "$CERT_PATH" \
-k "$KEYCHAIN_PATH" \
-P "$CSC_KEY_PASSWORD" \
-T /usr/bin/codesign \
-T /usr/bin/security
rm -f "$CERT_PATH"
# Add to the keychain search list (preserving login keychain)
security list-keychains -d user -s "$KEYCHAIN_PATH" login.keychain
# Allow codesign to access the key without a password prompt
security set-key-partition-list -S apple-tool:,apple:,codesign: -s \
-k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Extract identity for Electrobun
IDENTITY=$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" \
| grep "Developer ID Application" | head -1 | sed 's/.*"\(.*\)"/\1/')
if [ -z "$IDENTITY" ]; then
echo "::error::No 'Developer ID Application' identity found in certificate"
exit 1
fi
echo "Signing identity: $IDENTITY"
echo "developer_id=$IDENTITY" >> "$GITHUB_OUTPUT"
echo "skip_codesign=" >> "$GITHUB_OUTPUT"
- name: Sign native macOS effects dylib
if: matrix.platform.os == 'macos' && steps.macos-keychain.outputs.skip_codesign != '1'
env:
ELECTROBUN_DEVELOPER_ID: ${{ steps.macos-keychain.outputs.developer_id }}
run: |
DYLIB="packages/app-core/platforms/electrobun/src/libMacWindowEffects.dylib"
if [ ! -f "$DYLIB" ]; then
echo "::error::Expected $DYLIB to exist after build:native-effects"
exit 1
fi
codesign --force --timestamp --sign "$ELECTROBUN_DEVELOPER_ID" "$DYLIB"
codesign --verify --strict --verbose=2 "$DYLIB"
- name: Install quiet macOS packaging wrappers
if: matrix.platform.os == 'macos' && steps.macos-keychain.outputs.skip_codesign != '1'
run: |
wrapper_dir="$RUNNER_TEMP/eliza-notary-bin"
mkdir -p "$wrapper_dir"
cp packages/app-core/platforms/electrobun/scripts/hdiutil-wrapper.sh "$wrapper_dir/hdiutil"
cp packages/app-core/platforms/electrobun/scripts/xcrun-wrapper.sh "$wrapper_dir/xcrun"
cp packages/app-core/platforms/electrobun/scripts/zip-wrapper.sh "$wrapper_dir/zip"
chmod +x "$wrapper_dir/hdiutil"
chmod +x "$wrapper_dir/xcrun"
chmod +x "$wrapper_dir/zip"
echo "$wrapper_dir" >> "$GITHUB_PATH"
- name: Resolve electrobun package dir
id: resolve-electrobun
shell: bash
run: |
package_dir="$(node <<'NODE'
const { createRequire } = require("node:module");
const fs = require("node:fs");
const path = require("node:path");
const workspacePackageJson = path.resolve("packages/app-core/platforms/electrobun/package.json");
const req = createRequire(workspacePackageJson);
const entryPath = req.resolve("electrobun");
let packageDir = path.dirname(entryPath);
while (!fs.existsSync(path.join(packageDir, "package.json"))) {
const parentDir = path.dirname(packageDir);
if (parentDir === packageDir) {
throw new Error(
`Could not find electrobun package.json starting from ${entryPath}`,
);
}
packageDir = parentDir;
}
const manifestPath = path.join(packageDir, "package.json");
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
if (manifest.name !== "electrobun") {
throw new Error(
`Resolved unexpected package at ${manifestPath}: ${manifest.name}`,
);
}
process.stdout.write(packageDir);
NODE
)"
if [ -z "$package_dir" ]; then
echo "::error::Failed to resolve electrobun package directory"
exit 1
fi
case "${{ matrix.platform.artifact-name }}" in
macos-arm64|macos-x64|linux-x64|linux-arm64)
electrobun_core_target="${{ matrix.platform.artifact-name }}"
;;
windows-x64)
electrobun_core_target="win-x64"
;;
*)
echo "::error::Unsupported Electrobun release artifact target: ${{ matrix.platform.artifact-name }}"
exit 1
;;
esac
echo "Resolved electrobun package dir: $package_dir"
echo "package-dir=$package_dir" >> "$GITHUB_OUTPUT"
echo "cache-dir=$package_dir/.cache" >> "$GITHUB_OUTPUT"
echo "core-target=$electrobun_core_target" >> "$GITHUB_OUTPUT"
echo "core-cache-dir=$package_dir/dist-$electrobun_core_target" >> "$GITHUB_OUTPUT"
- name: Cache Electrobun CLI and core binaries
uses: actions/cache@v5
with:
path: |
${{ steps.resolve-electrobun.outputs.cache-dir }}
${{ steps.resolve-electrobun.outputs.core-cache-dir }}
key: electrobun-core-${{ matrix.platform.artifact-name }}-${{ hashFiles('packages/app-core/platforms/electrobun/package.json') }}
restore-keys: electrobun-core-${{ matrix.platform.artifact-name }}-
# TODO: verify this script exists in eliza. `ensure-electrobun-core.mjs`
# was eliza-only and is not present in upstream eliza/packages/app-core/scripts/.
# Without it the cache step above is decorative — Electrobun will fall
# back to its own download flow on first build. Port the script if you
# want pre-warmed core binaries on the first packaging run.
- name: Prepare Electrobun core binaries
run: |
if [ -f packages/app-core/scripts/ensure-electrobun-core.mjs ]; then
node packages/app-core/scripts/ensure-electrobun-core.mjs \
--package-dir "${{ steps.resolve-electrobun.outputs.package-dir }}" \
--target "${{ steps.resolve-electrobun.outputs.core-target }}"
else
echo "::warning::packages/app-core/scripts/ensure-electrobun-core.mjs not present — Electrobun will download core binaries on demand."
fi
- name: Probe Electrobun bun entry build
working-directory: packages/app-core/platforms/electrobun
run: |
out_dir="$RUNNER_TEMP/electrobun-entry-probe"
rm -rf "$out_dir"
bun build src/index.ts --target=bun --packages=external --outdir "$out_dir"
- name: Build patched Electrobun CLI
shell: bash
run: |
node packages/app-core/scripts/build-patched-electrobun-cli.mjs "${{ steps.resolve-electrobun.outputs.package-dir }}" "${{ matrix.platform.artifact-name }}"
- name: Build Electrobun app
id: build-electrobun-app
run: |
set +e
if [ "${{ matrix.platform.os }}" = "macos" ] && [ "${{ matrix.platform.artifact-name }}" = "macos-x64" ]; then
ELIZA_DESKTOP_COMMAND_PREFIX="arch -x86_64" node packages/app-core/scripts/desktop-build.mjs package --env=${{ needs.prepare.outputs.env }}
else
node packages/app-core/scripts/desktop-build.mjs package --env=${{ needs.prepare.outputs.env }}
fi
status=$?
set -e
if [ "$status" -eq 0 ]; then
echo "fallback=false" >> "$GITHUB_OUTPUT"
exit 0
fi
if [ "${{ inputs.draft }}" != "true" ] || [ "${{ inputs.publish_release }}" = "true" ]; then
exit "$status"
fi
artifact_root="packages/app-core/platforms/electrobun/artifacts"
build_root="packages/app-core/platforms/electrobun/build"
build_dir="$(find "$build_root" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sort | tail -1 || true)"
if [ -z "$build_dir" ]; then
echo "::error::Electrobun packaging failed and no built app tree exists"
exit "$status"
fi
VERSION="$(node -p "require('./packages/app-core/platforms/electrobun/package.json').version")"
ENV_NAME="${{ needs.prepare.outputs.env }}"
find -L "$build_dir" -type d -name "Resources" | while read -r res_dir; do
dest="$res_dir/version.json"
printf '{"identifier":"ai.elizaos.Eliza","channel":"%s","name":"eliza","version":"%s"}' \
"$ENV_NAME" "$VERSION" > "$dest"
echo "Wrote fallback $dest"
done
mkdir -p "$artifact_root"
case "${{ matrix.platform.os }}" in
linux)
tar --zstd -cf "$artifact_root/eliza-${{ needs.prepare.outputs.env }}-${{ matrix.platform.artifact-name }}.tar.zst" -C "$build_root" "$(basename "$build_dir")"
;;
macos)
tar -czf "$artifact_root/eliza-${{ needs.prepare.outputs.env }}-${{ matrix.platform.artifact-name }}.app.tar.gz" -C "$build_root" "$(basename "$build_dir")"
;;
windows)
powershell -NoProfile -Command "Compress-Archive -Path '$build_dir' -DestinationPath '$artifact_root/eliza-${{ needs.prepare.outputs.env }}-${{ matrix.platform.artifact-name }}.exe.zip' -Force"
;;
esac
echo "fallback=true" >> "$GITHUB_OUTPUT"
echo "::warning::Electrobun package command exited with $status; uploaded draft-validation fallback archive from $build_dir"
env:
# Electrobun reads these env vars directly. The workflow derives the
# signing identity from CSC_LINK/CSC_KEY_PASSWORD during keychain setup
# and maps the notarization credentials from the standard repo secrets.
ELECTROBUN_DEVELOPER_ID: ${{ steps.macos-keychain.outputs.developer_id }}
ELECTROBUN_APPLEID: ${{ secrets.APPLE_ID }}
ELECTROBUN_APPLEIDPASS: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
ELECTROBUN_TEAMID: ${{ secrets.APPLE_TEAM_ID }}
ELECTROBUN_SKIP_CODESIGN: ${{ steps.macos-keychain.outputs.skip_codesign }}
ELECTROBUN_REAL_HDIUTIL: /usr/bin/hdiutil
ELIZA_ELECTROBUN_NOTARIZE: 0
ELECTROBUN_REAL_XCRUN: /usr/bin/xcrun
ELECTROBUN_REAL_ZIP: /usr/bin/zip
ELIZA_ELECTROBUN_REPO_ROOT: ${{ github.workspace }}
# Flat release root for the updater. Env is encoded in the platform prefix
# (canary-macos-arm64-update.json etc.), so the baseUrl has no env subdir.
# Points to GitHub Releases as the CDN; the ota-publish job attaches
# latest-{channel}.json after the release job completes.
ELIZA_RELEASE_URL: ${{ (github.event_name != 'workflow_call' || inputs.publish_release) && !inputs.draft && format('https://github.com/{0}/releases/download/{1}/', github.repository, needs.prepare.outputs.tag) || '' }}
- name: Dump Electrobun build diagnostics
if: failure()
run: |
root="packages/app-core/platforms/electrobun"
echo "=== ${root}/build ==="
find -L "$root/build" -maxdepth 6 -type f -print 2>/dev/null | sort | head -300 || true
echo "=== ${root}/artifacts ==="
find -L "$root/artifacts" -maxdepth 6 -type f -print 2>/dev/null | sort | head -300 || true
echo "=== ${root} wrapper diagnostics ==="
find -L "$root/build" -name wrapper-diagnostics.json -print -exec sed -n '1,220p' {} \; 2>/dev/null || true
- name: Upload Electrobun build diagnostics
if: failure()
uses: actions/upload-artifact@v7
with:
name: electrobun-${{ matrix.platform.artifact-name }}-build-diagnostics
path: |
packages/app-core/platforms/electrobun/build/**
packages/app-core/platforms/electrobun/build/**/wrapper-diagnostics.json
packages/app-core/platforms/electrobun/artifacts/**
if-no-files-found: warn
retention-days: 14
# Inject version.json into the packaged Resources directory.
# The bun entry getVersionInfo() reads ../Resources/version.json and
# throws if absent, killing the process before main() runs.
# Electrobun does not generate this file for us, so write it from the
# release metadata after the packaged bundle exists.
- name: Inject version.json into bundle (Windows)
if: matrix.platform.os == 'windows'
shell: pwsh
run: |
$version = (Get-Content packages/app-core/platforms/electrobun/package.json | ConvertFrom-Json).version
$envName = "${{ needs.prepare.outputs.env }}"
$buildRoot = "packages/app-core/platforms/electrobun/build"
Get-ChildItem -Path $buildRoot -Recurse -Directory -Filter "Resources" | ForEach-Object {
$versionJson = @{
identifier = "ai.elizaos.Eliza"
channel = $envName
name = "eliza"
version = $version
} | ConvertTo-Json -Compress
$dest = Join-Path $_.FullName "version.json"
Write-Host "Writing $dest"
Set-Content -Path $dest -Value $versionJson -Encoding utf8
}
- name: Inject version.json into bundle (macOS / Linux)
if: matrix.platform.os != 'windows'
run: |
VERSION="$(node -p "require('./packages/app-core/platforms/electrobun/package.json').version")"
ENV_NAME="${{ needs.prepare.outputs.env }}"
build_root="packages/app-core/platforms/electrobun/build"
if [ -d "$build_root" ]; then
find -L "$build_root" -type d -name "Resources" | while read -r res_dir; do
dest="$res_dir/version.json"
printf '{"identifier":"ai.elizaos.Eliza","channel":"%s","name":"eliza","version":"%s"}' \
"$ENV_NAME" "$VERSION" > "$dest"
echo "Wrote $dest"
done
fi
- name: Package Linux desktop installers
if: matrix.platform.os == 'linux' && steps.build-electrobun-app.outputs.fallback != 'true'
run: |
node packages/app-core/scripts/package-electrobun-linux.mjs \
--version=${{ needs.prepare.outputs.version }} \
--channel=${{ needs.prepare.outputs.env }} \
--arch=x64
- name: List build output
run: |
echo "=== Electrobun artifacts ==="
find -L packages/app-core/platforms/electrobun/artifacts -type f 2>/dev/null | sort || echo "(no artifacts directory)"
- name: Stage standard macOS release app
if: matrix.platform.os == 'macos' && steps.build-electrobun-app.outputs.fallback != 'true'
env:
ELECTROBUN_DEVELOPER_ID: ${{ steps.macos-keychain.outputs.developer_id }}
ELECTROBUN_APPLEID: ${{ secrets.APPLE_ID }}
ELECTROBUN_APPLEIDPASS: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
ELECTROBUN_TEAMID: ${{ secrets.APPLE_TEAM_ID }}
ELECTROBUN_SKIP_CODESIGN: ${{ steps.macos-keychain.outputs.skip_codesign }}
run: bash packages/app-core/platforms/electrobun/scripts/stage-macos-release-artifacts.sh
- name: Sign Windows executables
if: matrix.platform.os == 'windows' && steps.build-electrobun-app.outputs.fallback != 'true'
env:
# Configure on elizaOS/eliza repo settings.
WINDOWS_SIGN_CERT_BASE64: ${{ secrets.WINDOWS_SIGN_CERT_BASE64 }}
WINDOWS_SIGN_CERT_PASSWORD: ${{ secrets.WINDOWS_SIGN_CERT_PASSWORD }}
WINDOWS_SIGN_TIMESTAMP_URL: ${{ secrets.WINDOWS_SIGN_TIMESTAMP_URL }}
shell: pwsh
run: pwsh -File packages/app-core/platforms/electrobun/scripts/sign-windows.ps1 -ArtifactsDir (Join-Path $PWD "packages/app-core/platforms/electrobun/artifacts") -BuildDir (Join-Path $PWD "packages/app-core/platforms/electrobun/build")
- name: Install Inno Setup 6.7.1
if: matrix.platform.os == 'windows' && steps.build-electrobun-app.outputs.fallback != 'true'
shell: pwsh
run: |
$url = "https://github.com/jrsoftware/issrc/releases/download/is-6_7_1/innosetup-6.7.1.exe"
$installer = Join-Path $env:RUNNER_TEMP "innosetup-6.7.1.exe"
Write-Host "Downloading Inno Setup 6.7.1..."
Invoke-WebRequest -Uri $url -OutFile $installer -UseBasicParsing
Write-Host "Installing silently..."
Start-Process -FilePath $installer -ArgumentList "/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/SP-" -Wait -NoNewWindow
$iscc = @(
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
"C:\Program Files\Inno Setup 6\ISCC.exe"
) | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $iscc) {
Write-Error "ISCC.exe not found after installing Inno Setup 6.7.1"
exit 1
}
Add-Content -Path $env:GITHUB_ENV -Value "ELIZA_INNO_SETUP_COMPILER=$iscc"
Write-Host "Using ISCC compiler: $iscc"
- name: Extract Windows app bundle for Inno Setup
if: matrix.platform.os == 'windows' && steps.build-electrobun-app.outputs.fallback != 'true'
shell: pwsh
run: |
$artifactsDir = Join-Path $PWD "packages/app-core/platforms/electrobun/artifacts"
$tarball = Get-ChildItem -Path $artifactsDir -File -Filter "*.tar.zst" -ErrorAction SilentlyContinue |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
if (-not $tarball) {
Write-Error "No .tar.zst archive found in artifacts"
exit 1
}
# Use a short path to avoid Windows MAX_PATH (260 char) limits
# with deeply nested node_modules inside the app bundle
$extractDir = "C:\e"
Remove-Item $extractDir -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $extractDir | Out-Null
Write-Host "Extracting $($tarball.Name) to $extractDir ..."
tar -xf $tarball.FullName -C $extractDir
Write-Host "Extracted top-level structure:"
Get-ChildItem -Path $extractDir -Recurse -Depth 3 | ForEach-Object { Write-Host " $($_.FullName)" }
# Verify the expected runtime entry point exists without mutating the
# extracted installer source tree. Inno follows recursively, so
# junction/copy aliases here can duplicate the deep runtime tree and
# trip Windows path handling during compilation.
$appRoot = Get-ChildItem -Path $extractDir -Directory | Select-Object -First 1
if ($appRoot) {
$resApp = Join-Path $appRoot.FullName "Resources\app"
$elizaDist = Join-Path $resApp "eliza-dist"
$entryCheckEliza = Join-Path $elizaDist "entry.js"
Write-Host "Checking for: $entryCheckEliza"
if (Test-Path $entryCheckEliza) {
Write-Host "eliza-dist/entry.js found"
} else {
Write-Host "WARNING: eliza-dist/entry.js NOT found"
Write-Host "Resources/app contents:"
if (Test-Path $resApp) {
Get-ChildItem -Path $resApp -Recurse -Depth 2 | ForEach-Object { Write-Host " $($_.FullName)" }
} else {
Write-Host " Resources/app directory does not exist"
}
}
$keywordDataCheck = Join-Path $elizaDist "node_modules\@elizaos\shared\src\i18n\generated\validation-keyword-data.js"
Write-Host "Checking for: $keywordDataCheck"
if (Test-Path $keywordDataCheck) {
Write-Host "eliza-dist generated keyword data found"
} else {
Write-Error "eliza-dist generated keyword data NOT found: $keywordDataCheck"
exit 1
}
$agentManifestPath = Join-Path $elizaDist "node_modules\@elizaos\agent\package.json"
Write-Host "Checking for: $agentManifestPath"
if (Test-Path $agentManifestPath) {
Write-Host "eliza-dist @elizaos/agent package manifest found"
} else {
Write-Error "eliza-dist @elizaos/agent package manifest NOT found: $agentManifestPath"
exit 1
}
}
- name: Build Inno Setup installer