Repository navigation
843 lines (746 loc) · 32.7 KB
/
Copy pathrelease.yml
File metadata and controls
843 lines (746 loc) · 32.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
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
name: Release
on:
push:
branches:
- main
paths-ignore:
- src/providers/models.json
- .github/scripts/generate-model-catalog.mjs
- .github/scripts/publish-model-catalog.mjs
- .github/scripts/apply-model-catalog-draft.mjs
- .github/workflows/publish-model-catalog.yml
- .github/workflows/model-catalog-admin-pr.yml
- .github/workflows/release.yml
- tests/github/modelCatalogDistributionWorkflow.test.ts
- docs/model-catalog.md
workflow_dispatch:
inputs:
version:
description: 'Version to release (leave empty for auto)'
required: false
channel:
description: 'Release channel'
required: true
default: 'release'
type: choice
options:
- alpha
- release
permissions:
contents: write
pull-requests: write
issues: write
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
channel: ${{ steps.determine.outputs.channel }}
version: ${{ steps.version.outputs.version }}
should_release: ${{ steps.check.outputs.should_release }}
macos_signing_mode: ${{ steps.macos-signing.outputs.mode }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Determine release channel
id: determine
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "channel=${{ github.event.inputs.channel }}" >> $GITHUB_OUTPUT
elif [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "channel=alpha" >> $GITHUB_OUTPUT
else
echo "channel=alpha" >> $GITHUB_OUTPUT
fi
- name: Check if should release
id: check
run: |
# Allow manual trigger to force release
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "should_release=true" >> $GITHUB_OUTPUT
echo "📦 Manual trigger - forcing release"
# Check if last commit is a version bump (skip if so)
elif git log -1 --pretty=%B | grep -q "chore(release):"; then
echo "should_release=false" >> $GITHUB_OUTPUT
echo "⏭️ Skipping - last commit is a release commit"
else
echo "should_release=true" >> $GITHUB_OUTPUT
fi
- name: Select macOS signing mode
id: macos-signing
if: steps.check.outputs.should_release == 'true'
env:
RELEASE_CHANNEL: ${{ steps.determine.outputs.channel }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
run: |
set -euo pipefail
required=(CSC_LINK CSC_KEY_PASSWORD APPLE_TEAM_ID APPLE_API_KEY APPLE_API_KEY_ID APPLE_API_ISSUER)
missing=()
for name in "${required[@]}"; do
if [ -z "${!name:-}" ]; then missing+=("$name"); fi
done
if [ "${#missing[@]}" -ne 0 ]; then
echo "::error::Apple signing is required for every release. Missing: ${missing[*]}."
exit 1
fi
echo "mode=developer-id" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 24
package-manager-cache: false
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Get version
id: version
env:
MANUAL_VERSION: ${{ github.event.inputs.version }}
RELEASE_CHANNEL: ${{ steps.determine.outputs.channel }}
RELEASE_EVENT_NAME: ${{ github.event_name }}
run: |
set -euo pipefail
CURRENT_VERSION=$(node -p "require('./package.json').version")
CHANNEL="$RELEASE_CHANNEL"
SHORT_SHA="${GITHUB_SHA::7}"
# Manual version override takes priority
if [ -n "$MANUAL_VERSION" ]; then
NEW_VERSION="${MANUAL_VERSION#v}"
echo "🎯 Using manual version override: ${NEW_VERSION}"
# For manual trigger without version, use current package.json version
elif [ "$RELEASE_EVENT_NAME" = "workflow_dispatch" ] && [ "$CHANNEL" = "release" ]; then
NEW_VERSION="${CURRENT_VERSION}"
echo "🎯 Using existing package.json version: ${NEW_VERSION}"
elif [ "$CHANNEL" = "alpha" ]; then
# Alpha: bump patch from the latest stable release tag, falling back to package.json.
LATEST_STABLE_TAG=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | grep -Ev -- '-(alpha|beta|rc|pre)' | head -n 1)
if [ -n "$LATEST_STABLE_TAG" ]; then
ALPHA_BASE_VERSION="${LATEST_STABLE_TAG#v}"
echo "🎯 Latest stable tag: ${LATEST_STABLE_TAG}"
else
ALPHA_BASE_VERSION="${CURRENT_VERSION}"
echo "🎯 No stable tag found; using package.json version: ${ALPHA_BASE_VERSION}"
fi
MAJOR=$(echo $ALPHA_BASE_VERSION | cut -d. -f1)
MINOR=$(echo $ALPHA_BASE_VERSION | cut -d. -f2)
PATCH=$(echo $ALPHA_BASE_VERSION | cut -d. -f3 | cut -d- -f1)
PATCH=$((PATCH + 1))
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}-alpha.${SHORT_SHA}"
echo "🎯 Alpha version: ${NEW_VERSION}"
else
# Fallback: bump patch
MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
PATCH=$(echo $CURRENT_VERSION | cut -d. -f3 | cut -d- -f1)
PATCH=$((PATCH + 1))
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
fi
if [ "$CHANNEL" = "release" ]; then
VERSION_PATTERN='^[0-9]+\.[0-9]+\.[0-9]+$'
else
VERSION_PATTERN='^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+([.-][0-9A-Za-z]+)*)?(\+[0-9A-Za-z]+([.-][0-9A-Za-z]+)*)?$'
fi
if [[ ! "$NEW_VERSION" =~ $VERSION_PATTERN ]]; then
echo "::error::Invalid ${CHANNEL} version: ${NEW_VERSION}"
exit 1
fi
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
echo "🎯 Version: ${NEW_VERSION} (${CHANNEL})"
- name: Validate npm publishing credentials
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "$NPM_TOKEN" ]; then
echo "::error::NPM_TOKEN is required for npm publishing"
exit 1
fi
test:
needs: prepare
if: needs.prepare.outputs.should_release == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 24
package-manager-cache: false
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Install ripgrep
run: sudo apt-get update && sudo apt-get install -y ripgrep tmux
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Type check
run: bun run typecheck
- name: Run tests
run: bun run test:ci -- --shard=${{ matrix.shard }}/3
tuistory:
needs: prepare
if: needs.prepare.outputs.should_release == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v7
with:
# The built terminal tests assert the CLI renders the latest stable
# release tag found via `git tag --merged HEAD`.
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 24
package-manager-cache: false
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Install ripgrep
run: sudo apt-get update && sudo apt-get install -y ripgrep tmux
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build CLI for terminal tests
run: bun run build
- name: Prepare pinned Zit for tmux isolation tests
run: node --input-type=module -e "import { installZit } from './scripts/install-zit.mjs'; await installZit({ force:true });"
- name: Run built terminal tests
run: bun run test:tuistory -- --shard=${{ matrix.shard }}/4
build:
needs: [prepare, test, tuistory]
if: needs.prepare.outputs.should_release == 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-26
target: darwin-arm64
artifact: autohand-macos-arm64
tracesArtifact: ahtraces-macos-arm64
computerUseArtifact: autohand-computer-use-darwin-arm64.tar.gz
- os: macos-26-intel
target: darwin-x64
artifact: autohand-macos-x64
tracesArtifact: ahtraces-macos-x64
computerUseArtifact: autohand-computer-use-darwin-x64.tar.gz
- os: ubuntu-latest
target: linux-x64
artifact: autohand-linux-x64
tracesArtifact: ahtraces-linux-x64
- os: ubuntu-latest
target: linux-arm64
artifact: autohand-linux-arm64
tracesArtifact: ahtraces-linux-arm64
- os: ubuntu-latest
target: linux-x64-musl
artifact: autohand-linux-x64-musl
tracesArtifact: ahtraces-linux-x64-musl
- os: ubuntu-latest
target: linux-arm64-musl
artifact: autohand-linux-arm64-musl
tracesArtifact: ahtraces-linux-arm64-musl
- os: windows-latest
target: windows-x64
artifact: autohand-windows-x64.exe
tracesArtifact: ahtraces-windows-x64.exe
- os: windows-latest
target: windows-arm64
artifact: autohand-windows-arm64.exe
tracesArtifact: ahtraces-windows-arm64.exe
steps:
- uses: actions/checkout@v7
- name: Read pinned ahtraces revision
id: ahtraces-ref
shell: bash
run: |
set -euo pipefail
revision=$(tr -d '[:space:]' < .github/ahtraces-ref)
if ! [[ "$revision" =~ ^[0-9a-f]{40}$ ]]; then
echo "::error::.github/ahtraces-ref must contain one full commit SHA"
exit 1
fi
echo "sha=$revision" >> "$GITHUB_OUTPUT"
- name: Checkout pinned ahtraces component
uses: actions/checkout@v7
with:
repository: autohandai/ahtraces
ref: ${{ steps.ahtraces-ref.outputs.sha }}
path: ahtraces-component
token: ${{ secrets.AHTRACES_REPO_TOKEN }}
persist-credentials: false
- name: Read pinned computer-use revision
id: computer-use-ref
shell: bash
run: |
set -euo pipefail
revision=$(tr -d '[:space:]' < .github/computer-use-ref)
if ! [[ "$revision" =~ ^[0-9a-f]{40}$ ]]; then
echo "::error::.github/computer-use-ref must contain one full commit SHA"
exit 1
fi
echo "sha=$revision" >> "$GITHUB_OUTPUT"
- name: Checkout pinned computer-use component
uses: actions/checkout@v7
with:
repository: autohandai/computer-use
ref: ${{ steps.computer-use-ref.outputs.sha }}
path: computer-use-component
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 24
package-manager-cache: false
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Install dependencies
run: bun install --frozen-lockfile --cpu="*"
- name: Install ahtraces dependencies
working-directory: ahtraces-component
run: bun install --frozen-lockfile --cpu="*"
- name: Update version before build
run: |
echo "Setting version to: ${{ needs.prepare.outputs.version }}"
npm version "${{ needs.prepare.outputs.version }}" --no-git-tag-version --allow-same-version
- name: Build TypeScript
run: bun run build
- name: Compile binaries
shell: bash
env:
BUILD_GIT_COMMIT: ${{ steps.ahtraces-ref.outputs.sha }}
run: |
mkdir -p binaries
# node-llama-cpp lazily requires one @node-llama-cpp/<platform> prebuilt
# binary at runtime, chosen dynamically from ~13 optional platform
# packages. Only the current platform's package is ever installed, so
# bundling the module makes bun statically resolve every other
# platform's import() and fail. Externalizing leaves the dynamic
# import for Node/Bun module resolution at runtime, same as `sharp`
# in tsup.config.ts.
AUTOHAND_BUILD_VERSION="${{ needs.prepare.outputs.version }}" AUTOHAND_BUILD_GIT_COMMIT="${GITHUB_SHA}" bun build ./src/index.ts --compile --target=bun-${{ matrix.target }} --external node-llama-cpp '--env=AUTOHAND_BUILD_*' --outfile ./binaries/${{ matrix.artifact }}
bun build ./ahtraces-component/src/index.ts --compile --target=bun-${{ matrix.target }} '--env=BUILD_GIT_*' --outfile ./binaries/${{ matrix.tracesArtifact }}
- name: Import macOS signing certificate
if: runner.os == 'macOS' && needs.prepare.outputs.macos_signing_mode == 'developer-id'
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
run: bash computer-use-component/autohand/scripts/import-apple-signing.sh
- name: Build Autohand Computer Use host
if: runner.os == 'macOS'
env:
AUTOHAND_BUILD_VERSION: ${{ needs.prepare.outputs.version }}
run: |
./computer-use-component/autohand/scripts/build-macos-host.sh --output "./binaries/Autohand Computer Use.app" --version "$AUTOHAND_BUILD_VERSION"
- name: Sign and notarize macOS artifacts
if: runner.os == 'macOS' && needs.prepare.outputs.macos_signing_mode == 'developer-id'
env:
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
run: |
set -euo pipefail
IDENTITY="$AUTOHAND_CODESIGN_IDENTITY"
codesign --force --timestamp --options runtime --sign "$IDENTITY" --keychain "$AUTOHAND_CODESIGN_KEYCHAIN" \
--entitlements "./native/macos/cli.entitlements.plist" \
./binaries/${{ matrix.artifact }}
codesign --verify --strict --verbose=4 ./binaries/${{ matrix.artifact }}
codesign --force --timestamp --options runtime --sign "$IDENTITY" --keychain "$AUTOHAND_CODESIGN_KEYCHAIN" \
--entitlements "./native/macos/cli.entitlements.plist" \
./binaries/${{ matrix.tracesArtifact }}
codesign --verify --strict --verbose=4 ./binaries/${{ matrix.tracesArtifact }}
codesign --force --timestamp --options runtime --sign "$IDENTITY" --keychain "$AUTOHAND_CODESIGN_KEYCHAIN" \
"./binaries/Autohand Computer Use.app"
codesign --verify --deep --strict --verbose=4 "./binaries/Autohand Computer Use.app"
mkdir -p ./binaries/notarization
cp ./binaries/${{ matrix.artifact }} ./binaries/notarization/
cp ./binaries/${{ matrix.tracesArtifact }} ./binaries/notarization/
ditto "./binaries/Autohand Computer Use.app" \
"./binaries/notarization/Autohand Computer Use.app"
ditto -c -k --keepParent ./binaries/notarization \
./binaries/autohand-macos-notarization.zip
xcrun notarytool submit ./binaries/autohand-macos-notarization.zip \
--key "$APPLE_API_KEY_PATH" \
--key-id "$APPLE_API_KEY_ID" \
--issuer "$APPLE_API_ISSUER" \
--wait --timeout 20m
xcrun stapler staple "./binaries/Autohand Computer Use.app"
spctl -a -vv -t exec "./binaries/Autohand Computer Use.app"
rm -rf ./binaries/notarization ./binaries/autohand-macos-notarization.zip
tar -czf "./binaries/autohand-computer-use-${{ matrix.target }}.tar.gz" \
-C ./binaries "Autohand Computer Use.app"
- name: Verify binary
if: runner.os != 'Windows' && !contains(matrix.target, 'arm64') || matrix.os == 'macos-26' && contains(matrix.target, 'arm64')
run: |
chmod +x ./binaries/${{ matrix.artifact }}
file ./binaries/${{ matrix.artifact }}
chmod +x ./binaries/${{ matrix.tracesArtifact }}
file ./binaries/${{ matrix.tracesArtifact }}
- name: Smoke test binary
if: runner.os != 'Windows' && !contains(matrix.target, 'arm64') && !contains(matrix.target, 'musl') || matrix.os == 'macos-26' && contains(matrix.target, 'arm64')
shell: bash
run: |
# Helper: run a command with a timeout (works on both Linux and macOS)
run_with_timeout() {
local secs="$1"; shift
"$@" &
local pid=$!
( sleep "$secs" && kill "$pid" 2>/dev/null ) &
local watchdog=$!
wait "$pid" 2>/dev/null
local rc=$?
kill "$watchdog" 2>/dev/null
wait "$watchdog" 2>/dev/null || true
return $rc
}
echo "Testing --version..."
run_with_timeout 10 ./binaries/${{ matrix.artifact }} --version < /dev/null
echo ""
echo "Testing --help..."
run_with_timeout 10 ./binaries/${{ matrix.artifact }} --help < /dev/null > /dev/null
echo "Testing ahtraces --version..."
run_with_timeout 10 ./binaries/${{ matrix.tracesArtifact }} --version < /dev/null
echo "Smoke test passed!"
- name: Smoke test musl binary on Alpine
if: matrix.target == 'linux-x64-musl'
timeout-minutes: 3
run: |
docker run --rm -v "$PWD/binaries:/binaries:ro" alpine:3 sh -ec '
apk add --no-cache libstdc++
/binaries/autohand-linux-x64-musl --version
/binaries/autohand-linux-x64-musl --help > /dev/null
/binaries/ahtraces-linux-x64-musl --version
'
- name: Smoke test Windows binary
if: runner.os == 'Windows' && !contains(matrix.target, 'arm64')
shell: pwsh
timeout-minutes: 1
run: |
$binary = (Resolve-Path "./binaries/${{ matrix.artifact }}").Path
$tracesBinary = (Resolve-Path "./binaries/${{ matrix.tracesArtifact }}").Path
& $binary --version
if ($LASTEXITCODE -ne 0) {
throw "Windows --version smoke test failed with exit code $LASTEXITCODE"
}
& $binary --help | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Windows --help smoke test failed with exit code $LASTEXITCODE"
}
& $tracesBinary --version
if ($LASTEXITCODE -ne 0) {
throw "Windows ahtraces --version smoke test failed with exit code $LASTEXITCODE"
}
- name: Verify fresh alpha installation
if: runner.os != 'Windows' && !contains(matrix.target, 'arm64') && !contains(matrix.target, 'musl') || matrix.os == 'macos-26' && contains(matrix.target, 'arm64')
shell: bash
timeout-minutes: 10
run: |
host_archive=""
if [ "${{ runner.os }}" = "macOS" ]; then
host_archive="./binaries/autohand-computer-use-${{ matrix.target }}.tar.gz"
fi
sh src/testing/scenarios/fresh-alpha-install.sh \
"./binaries/${{ matrix.artifact }}" "${{ needs.prepare.outputs.version }}" \
"./binaries/${{ matrix.tracesArtifact }}" "$host_archive"
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: |
./binaries/${{ matrix.artifact }}
./binaries/${{ matrix.tracesArtifact }}
./binaries/autohand-computer-use-*.tar.gz
retention-days: 1
- name: Remove temporary Apple signing credentials
if: always() && runner.os == 'macOS'
shell: bash
run: |
if [ -f "$RUNNER_TEMP/autohand-signing.keychain-db" ]; then
security delete-keychain "$RUNNER_TEMP/autohand-signing.keychain-db"
fi
rm -f "$RUNNER_TEMP/AutohandNotary.p8" "$RUNNER_TEMP/autohand-signing.p12"
verify-macos-artifacts:
needs: [prepare, build]
if: needs.prepare.outputs.should_release == 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-26
artifact: autohand-macos-arm64
tracesArtifact: ahtraces-macos-arm64
computerUseArtifact: autohand-computer-use-darwin-arm64.tar.gz
- os: macos-26-intel
artifact: autohand-macos-x64
tracesArtifact: ahtraces-macos-x64
computerUseArtifact: autohand-computer-use-darwin-x64.tar.gz
steps:
- name: Download macOS artifact
uses: actions/download-artifact@v8
with:
name: ${{ matrix.artifact }}
path: binaries
- name: Verify transported macOS binary
shell: bash
env:
MACOS_SIGNING_MODE: ${{ needs.prepare.outputs.macos_signing_mode }}
run: |
set -euo pipefail
binary="./binaries/${{ matrix.artifact }}"
ahtraces="./binaries/${{ matrix.tracesArtifact }}"
computer_use_archive="./binaries/${{ matrix.computerUseArtifact }}"
chmod +x "$binary"
file "$binary"
codesign --verify --strict --verbose=4 "$binary"
codesign --verify --strict -R=notarized --check-notarization "$binary"
"$binary" --version < /dev/null
chmod +x "$ahtraces"
file "$ahtraces"
codesign --verify --strict --verbose=4 "$ahtraces"
codesign --verify --strict -R=notarized --check-notarization "$ahtraces"
"$ahtraces" --version < /dev/null
mkdir -p computer-use-verification
tar -xzf "$computer_use_archive" -C computer-use-verification
codesign --verify --deep --strict --verbose=4 "computer-use-verification/Autohand Computer Use.app"
if [ "$MACOS_SIGNING_MODE" = "developer-id" ]; then
xcrun stapler validate "computer-use-verification/Autohand Computer Use.app"
spctl -a -vv -t exec "computer-use-verification/Autohand Computer Use.app"
fi
release:
needs: [prepare, build, verify-macos-artifacts]
if: needs.prepare.outputs.should_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 24
package-manager-cache: false
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Prepare release binaries
run: |
mkdir -p release-binaries
find artifacts -type f -exec cp {} release-binaries/ \;
for traces_binary in release-binaries/ahtraces-*; do
sha256sum "$traces_binary" > "${traces_binary}.sha256"
done
ls -lh release-binaries/
- name: Create bundled archives for installers and ACP registry
run: |
set -euo pipefail
cd release-binaries
bundle_unix() {
local binary="$1"
local traces_binary="$2"
local computer_use_archive="${3:-}"
local temp_dir
temp_dir=$(mktemp -d)
mkdir -p "${temp_dir}/bundle"
cp "$binary" "${temp_dir}/bundle/autohand"
chmod +x "${temp_dir}/bundle/autohand"
cp "$traces_binary" "${temp_dir}/bundle/ahtraces"
chmod +x "${temp_dir}/bundle/ahtraces"
if [ -n "$computer_use_archive" ]; then
tar -xzf "$computer_use_archive" -C "${temp_dir}/bundle"
fi
if [ -d "${temp_dir}/bundle/Autohand Computer Use.app" ]; then
tar -czf "${binary}.tar.gz" -C "${temp_dir}/bundle" autohand ahtraces "Autohand Computer Use.app"
else
tar -czf "${binary}.tar.gz" -C "${temp_dir}/bundle" autohand ahtraces
fi
sha256sum "${binary}.tar.gz" > "${binary}.tar.gz.sha256"
rm -rf "$temp_dir"
echo "✅ Created ${binary}.tar.gz"
}
bundle_windows() {
local binary="$1"
local traces_binary="$2"
local archive_name="$3"
local output_path="${PWD}/${archive_name}"
local temp_dir
temp_dir=$(mktemp -d)
mkdir -p "${temp_dir}/bundle"
cp "$binary" "${temp_dir}/bundle/autohand.exe"
cp "$traces_binary" "${temp_dir}/bundle/ahtraces.exe"
(
cd "${temp_dir}/bundle"
zip -q "$output_path" autohand.exe ahtraces.exe
)
sha256sum "${archive_name}" > "${archive_name}.sha256"
rm -rf "$temp_dir"
echo "✅ Created ${archive_name}"
}
# Create tar.gz bundles for Unix platforms
if [ -f "autohand-macos-arm64" ]; then
chmod +x autohand-macos-arm64
bundle_unix "autohand-macos-arm64" "ahtraces-macos-arm64" "autohand-computer-use-darwin-arm64.tar.gz"
fi
if [ -f "autohand-macos-x64" ]; then
chmod +x autohand-macos-x64
bundle_unix "autohand-macos-x64" "ahtraces-macos-x64" "autohand-computer-use-darwin-x64.tar.gz"
fi
if [ -f "autohand-linux-x64" ]; then
chmod +x autohand-linux-x64
bundle_unix "autohand-linux-x64" "ahtraces-linux-x64"
fi
if [ -f "autohand-linux-arm64" ]; then
chmod +x autohand-linux-arm64
bundle_unix "autohand-linux-arm64" "ahtraces-linux-arm64"
fi
if [ -f "autohand-linux-x64-musl" ]; then
chmod +x autohand-linux-x64-musl
bundle_unix "autohand-linux-x64-musl" "ahtraces-linux-x64-musl"
fi
if [ -f "autohand-linux-arm64-musl" ]; then
chmod +x autohand-linux-arm64-musl
bundle_unix "autohand-linux-arm64-musl" "ahtraces-linux-arm64-musl"
fi
# Create bundled zip for Windows
if [ -f "autohand-windows-x64.exe" ]; then
bundle_windows "autohand-windows-x64.exe" "ahtraces-windows-x64.exe" "autohand-windows-x64.zip"
fi
if [ -f "autohand-windows-arm64.exe" ]; then
bundle_windows "autohand-windows-arm64.exe" "ahtraces-windows-arm64.exe" "autohand-windows-arm64.zip"
fi
ls -lh *.tar.gz *.tar.gz.sha256 *.zip *.zip.sha256 2>/dev/null || true
- name: Prepare Homebrew tap update (release only)
if: needs.prepare.outputs.channel == 'release'
env:
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
run: |
set -euo pipefail
if [ -z "$TAP_GITHUB_TOKEN" ]; then
echo "::error::TAP_GITHUB_TOKEN is required for stable releases"
exit 1
fi
VERSION="${{ needs.prepare.outputs.version }}"
echo "Preparing Homebrew tap update for v${VERSION}..."
TAP_VISIBILITY=$(GH_TOKEN="$TAP_GITHUB_TOKEN" gh api repos/autohandai/homebrew-code --jq .visibility)
TAP_CAN_PUSH=$(GH_TOKEN="$TAP_GITHUB_TOKEN" gh api repos/autohandai/homebrew-code --jq '.permissions.push // false')
if [ "$TAP_VISIBILITY" != "public" ]; then
echo "::error::autohandai/homebrew-code must be public"
exit 1
fi
if [ "$TAP_CAN_PUSH" != "true" ]; then
echo "::error::TAP_GITHUB_TOKEN must have push access to autohandai/homebrew-code"
exit 1
fi
SHA_MACOS_ARM64=$(sha256sum "release-binaries/autohand-macos-arm64.tar.gz" | cut -d' ' -f1)
SHA_MACOS_X64=$(sha256sum "release-binaries/autohand-macos-x64.tar.gz" | cut -d' ' -f1)
SHA_LINUX_ARM64=$(sha256sum "release-binaries/autohand-linux-arm64.tar.gz" | cut -d' ' -f1)
SHA_LINUX_X64=$(sha256sum "release-binaries/autohand-linux-x64.tar.gz" | cut -d' ' -f1)
git clone https://github.com/autohandai/homebrew-code.git homebrew-tap
node .github/render-homebrew-formula.mjs \
--version "$VERSION" \
--macos-arm64-sha "$SHA_MACOS_ARM64" \
--macos-x64-sha "$SHA_MACOS_X64" \
--linux-arm64-sha "$SHA_LINUX_ARM64" \
--linux-x64-sha "$SHA_LINUX_X64" \
--output homebrew-tap/Formula/autohand-code.rb
ruby -c homebrew-tap/Formula/autohand-code.rb
git -C homebrew-tap diff --check
git -C homebrew-tap config user.name "github-actions[bot]"
git -C homebrew-tap config user.email "github-actions[bot]@users.noreply.github.com"
git -C homebrew-tap add Formula/autohand-code.rb
- name: Build and verify npm package
run: |
mkdir -p native/macos/prebuilt/arm64 native/macos/prebuilt/x64
tar -xzf release-binaries/autohand-computer-use-darwin-arm64.tar.gz -C native/macos/prebuilt/arm64
tar -xzf release-binaries/autohand-computer-use-darwin-x64.tar.gz -C native/macos/prebuilt/x64
bun install --frozen-lockfile
npm version "${{ needs.prepare.outputs.version }}" --no-git-tag-version --allow-same-version
bun run build
npm pack --dry-run
ls -lh dist/
- name: Generate release notes
run: |
node .github/generate-release-notes.mjs \
--version "${{ needs.prepare.outputs.version }}" \
--channel "${{ needs.prepare.outputs.channel }}" \
--repo "${{ github.repository }}" \
--output release-notes.md
cat release-notes.md
- name: Create Release
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ needs.prepare.outputs.version }}
name: ${{ needs.prepare.outputs.channel == 'release' && format('Release v{0}', needs.prepare.outputs.version) || format('Alpha v{0}', needs.prepare.outputs.version) }}
body_path: release-notes.md
files: |
release-binaries/*
install.sh
install.ps1
draft: false
prerelease: ${{ needs.prepare.outputs.channel != 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Homebrew tap
if: needs.prepare.outputs.channel == 'release'
env:
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
run: |
set -euo pipefail
VERSION="${{ needs.prepare.outputs.version }}"
echo "Updating Homebrew tap to v${VERSION}..."
if git -C homebrew-tap diff --cached --quiet; then
echo "Homebrew tap already matches v${VERSION}"
else
git -C homebrew-tap commit -m "Update autohand-code to v${VERSION}"
git -C homebrew-tap remote set-url origin "https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/autohandai/homebrew-code.git"
git -C homebrew-tap push origin HEAD
echo "Homebrew tap updated to v${VERSION}"
fi
- name: Publish to npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "$NPM_TOKEN" ]; then
echo "::error::NPM_TOKEN is required for npm publishing"
exit 1
fi
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
VERSION="${{ needs.prepare.outputs.version }}"
if [ "${{ needs.prepare.outputs.channel }}" = "alpha" ]; then
NPM_DIST_TAG="alpha"
else
NPM_DIST_TAG="latest"
fi
if npm view "autohand-cli@$VERSION" version --json > /dev/null 2>&1; then
echo "autohand-cli@$VERSION is already published; updating the $NPM_DIST_TAG dist-tag"
npm dist-tag add "autohand-cli@$VERSION" "$NPM_DIST_TAG"
else
npm publish --access public --tag "$NPM_DIST_TAG"
fi