Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

release.yml

1,024 lines40.1 KB

1name: Release
2​
3on:
4 push:
5 tags:
6 - "v*.*.*"
7 - "!v*-nightly.*"
8 schedule:
9 - cron: "0 */3 * * *"
10 workflow_dispatch:
11 inputs:
12 channel:
13 description: "Release channel"
14 required: false
15 default: stable
16 type: choice
17 options:
18 - stable
19 - nightly
20 version:
21 description: "Release version (for example 1.2.3 or v1.2.3)"
22 required: false
23 type: string
24​
25permissions:
26 contents: read
27 id-token: none
28​
29jobs:
30 check_changes:
31 name: Check for changes since last nightly
32 if: github.event_name == 'schedule'
33 runs-on: blacksmith-8vcpu-ubuntu-2404
34 outputs:
35 has_changes: ${{ steps.check.outputs.has_changes }}
36 steps:
37 - name: Checkout
38 uses: actions/checkout@v6
39 with:
40 fetch-depth: 0
41​
42 - id: check
43 name: Compare HEAD to last nightly tag
44 run: |
45 last_nightly_tag=$(git tag --list 'v*-nightly.*' 'nightly-v*' --sort=-creatordate | head -n 1)
46 if [[ -z "$last_nightly_tag" ]]; then
47 echo "No previous nightly tag found. Proceeding with release."
48 echo "has_changes=true" >> "$GITHUB_OUTPUT"
49 exit 0
50 fi
51​
52 last_nightly_sha=$(git rev-parse "$last_nightly_tag^{commit}")
53 head_sha=$(git rev-parse HEAD)
54​
55 if [[ "$last_nightly_sha" == "$head_sha" ]]; then
56 echo "No changes on main since last nightly release ($last_nightly_tag). Skipping."
57 echo "has_changes=false" >> "$GITHUB_OUTPUT"
58 else
59 echo "Changes detected on main since $last_nightly_tag ($last_nightly_sha → $head_sha). Proceeding."
60 echo "has_changes=true" >> "$GITHUB_OUTPUT"
61 fi
62​
63 preflight:
64 name: Preflight
65 needs: [check_changes]
66 if: |
67 !failure() && !cancelled() &&
68 (github.event_name != 'schedule' || needs.check_changes.outputs.has_changes == 'true')
69 runs-on: blacksmith-8vcpu-ubuntu-2404
70 timeout-minutes: 10
71 outputs:
72 release_channel: ${{ steps.release_meta.outputs.release_channel }}
73 version: ${{ steps.release_meta.outputs.version }}
74 tag: ${{ steps.release_meta.outputs.tag }}
75 release_name: ${{ steps.release_meta.outputs.name }}
76 short_sha: ${{ steps.release_meta.outputs.short_sha }}
77 previous_tag: ${{ steps.previous_tag.outputs.previous_tag }}
78 cli_dist_tag: ${{ steps.release_meta.outputs.cli_dist_tag }}
79 is_prerelease: ${{ steps.release_meta.outputs.is_prerelease }}
80 make_latest: ${{ steps.release_meta.outputs.make_latest }}
81 ref: ${{ github.sha }}
82 steps:
83 - name: Checkout
84 uses: actions/checkout@v6
85 with:
86 fetch-depth: 0
87​
88 - name: Setup Vite+
89 uses: voidzero-dev/setup-vp@v1
90 with:
91 node-version-file: package.json
92 cache: true
93 run-install: true
94​
95 - name: Ensure Electron runtime is installed
96 run: vp run --filter @t3tools/desktop ensure:electron
97​
98 - id: release_meta
99 name: Resolve release version
100 shell: bash
101 env:
102 DISPATCH_CHANNEL: ${{ github.event.inputs.channel }}
103 DISPATCH_VERSION: ${{ github.event.inputs.version }}
104 NIGHTLY_DATE: ${{ github.run_started_at }}
105 NIGHTLY_SHA: ${{ github.sha }}
106 NIGHTLY_RUN_NUMBER: ${{ github.run_number }}
107 run: |
108 if [[ "${GITHUB_EVENT_NAME}" == "schedule" || ( "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-stable}" == "nightly" ) ]]; then
109 nightly_date="$(date -u -d "$NIGHTLY_DATE" +%Y%m%d)"
110​
111 node scripts/resolve-nightly-release.ts \
112 --date "$nightly_date" \
113 --run-number "$NIGHTLY_RUN_NUMBER" \
114 --sha "$NIGHTLY_SHA" \
115 --github-output
116​
117 echo "release_channel=nightly" >> "$GITHUB_OUTPUT"
118 echo "cli_dist_tag=nightly" >> "$GITHUB_OUTPUT"
119 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
120 echo "make_latest=false" >> "$GITHUB_OUTPUT"
121 else
122 if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
123 raw="${DISPATCH_VERSION}"
124 if [[ -z "$raw" ]]; then
125 echo "workflow_dispatch stable releases require the version input." >&2
126 exit 1
127 fi
128 else
129 raw="${GITHUB_REF_NAME}"
130 fi
131​
132 version="${raw#v}"
133 if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
134 echo "Invalid release version: $raw" >&2
135 exit 1
136 fi
137​
138 echo "release_channel=stable" >> "$GITHUB_OUTPUT"
139 echo "version=$version" >> "$GITHUB_OUTPUT"
140 echo "tag=v$version" >> "$GITHUB_OUTPUT"
141 echo "name=T3 Code v$version" >> "$GITHUB_OUTPUT"
142 echo "cli_dist_tag=latest" >> "$GITHUB_OUTPUT"
143 if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
144 echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
145 echo "make_latest=true" >> "$GITHUB_OUTPUT"
146 else
147 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
148 echo "make_latest=false" >> "$GITHUB_OUTPUT"
149 fi
150 fi
151​
152 - name: Check
153 run: vp check
154​
155 - name: Typecheck
156 run: vp run typecheck
157​
158 - name: Test
159 run: vp run test
160​
161 - id: previous_tag
162 name: Resolve previous release tag
163 run: |
164 node scripts/resolve-previous-release-tag.ts \
165 --channel "${{ steps.release_meta.outputs.release_channel }}" \
166 --current-tag "${{ steps.release_meta.outputs.tag }}" \
167 --github-output
168​
169 relay_public_config:
170 name: Resolve T3 Connect public config
171 needs: preflight
172 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
173 runs-on: blacksmith-8vcpu-ubuntu-2404
174 timeout-minutes: 5
175 environment:
176 name: production
177 outputs:
178 clerk_publishable_key: ${{ steps.public_config.outputs.clerk_publishable_key }}
179 clerk_jwt_template: ${{ steps.public_config.outputs.clerk_jwt_template }}
180 clerk_cli_oauth_client_id: ${{ steps.public_config.outputs.clerk_cli_oauth_client_id }}
181 relay_url: ${{ steps.public_config.outputs.relay_url }}
182 env:
183 CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
184 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
185 RELAY_DOMAIN: ${{ vars.RELAY_DOMAIN }}
186 RELAY_API_ZONE_NAME: ${{ vars.RELAY_API_ZONE_NAME }}
187 CLERK_PUBLISHABLE_KEY: ${{ vars.CLERK_PUBLISHABLE_KEY }}
188 CLERK_JWT_TEMPLATE: ${{ vars.CLERK_JWT_TEMPLATE }}
189 CLERK_CLI_OAUTH_CLIENT_ID: ${{ vars.CLERK_CLI_OAUTH_CLIENT_ID }}
190 steps:
191 - name: Checkout
192 uses: actions/checkout@v6
193 with:
194 ref: ${{ needs.preflight.outputs.ref }}
195​
196 - name: Setup Vite+
197 uses: voidzero-dev/setup-vp@v1
198 with:
199 node-version-file: package.json
200 cache: true
201 run-install: |
202 args:
203 - --filter=t3code-relay...
204​
205 - id: relay_state
206 name: Read production relay tracing config
207 shell: bash
208 run: |
209 vp run --filter t3code-relay deploy \
210 --stage prod \
211 --read-state \
212 --github-output \
213 --github-env-file "$RUNNER_TEMP/relay-client-tracing.env"
214​
215 - name: Upload relay client tracing config
216 uses: actions/upload-artifact@v7
217 with:
218 name: relay-client-tracing-config
219 path: ${{ runner.temp }}/relay-client-tracing.env
220 if-no-files-found: error
221 retention-days: 1
222​
223 - id: public_config
224 name: Resolve production relay public config
225 shell: bash
226 run: |
227 set -euo pipefail
228​
229 relay_domain="${RELAY_DOMAIN:-}"
230 if [[ -z "$relay_domain" && -n "${RELAY_API_ZONE_NAME:-}" ]]; then
231 relay_domain="relay.$RELAY_API_ZONE_NAME"
232 fi
233 required=(
234 relay_domain
235 CLERK_PUBLISHABLE_KEY
236 CLERK_JWT_TEMPLATE
237 CLERK_CLI_OAUTH_CLIENT_ID
238 )
239 missing=()
240 for name in "${required[@]}"; do
241 if [[ -z "${!name:-}" ]]; then
242 missing+=("$name")
243 fi
244 done
245 if (( ${#missing[@]} > 0 )); then
246 printf 'Missing required relay deployment configuration: %s\n' "${missing[*]}" >&2
247 exit 1
248 fi
249​
250 echo "clerk_publishable_key=$CLERK_PUBLISHABLE_KEY" >> "$GITHUB_OUTPUT"
251 echo "clerk_jwt_template=$CLERK_JWT_TEMPLATE" >> "$GITHUB_OUTPUT"
252 echo "clerk_cli_oauth_client_id=$CLERK_CLI_OAUTH_CLIENT_ID" >> "$GITHUB_OUTPUT"
253 echo "relay_url=https://$relay_domain" >> "$GITHUB_OUTPUT"
254​
255 # node-pty publishes no Linux prebuilt and the WSL backend runs under the
256 # distro's own (Linux) Node, which can't load the Windows/Electron binary. We
257 # build the Linux pty.node here, on Linux, and hand it to the Windows packaging
258 # job — the Windows artifact then ships a ready WSL backend binary with no
259 # cross-compiling and no first-launch compiler/node-gyp/network on the user's
260 # machine. node-pty is N-API, so one binary works across all WSL Node versions.
261 build_wsl_node_pty:
262 name: Build WSL node-pty (linux-x64)
263 needs: [preflight]
264 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
265 runs-on: blacksmith-8vcpu-ubuntu-2404
266 timeout-minutes: 15
267 steps:
268 - name: Checkout
269 uses: actions/checkout@v6
270 with:
271 ref: ${{ needs.preflight.outputs.ref }}
272 fetch-depth: 0
273​
274 - name: Setup Vite+
275 uses: voidzero-dev/setup-vp@v1
276 with:
277 node-version-file: package.json
278 cache: true
279 run-install: true
280​
281 - name: Build node-pty linux-x64 prebuild
282 shell: bash
283 run: |
284 set -euo pipefail
285 # Resolve node-pty from apps/server (where it's a dependency) and build
286 # its native binary from source for Linux. node-addon-api resolves from
287 # node-pty's own dependency tree, so node-gyp has everything it needs.
288 pty_pkg="$(node -e "console.log(require.resolve('node-pty/package.json', { paths: ['$GITHUB_WORKSPACE/apps/server'] }))")"
289 pty_dir="$(dirname "$pty_pkg")"
290 ( cd "$pty_dir" && npx --yes node-gyp rebuild )
291 mkdir -p wsl-prebuild
292 cp "$pty_dir/build/Release/pty.node" wsl-prebuild/pty.node
293 file wsl-prebuild/pty.node
294​
295 - name: Upload node-pty linux-x64 prebuild
296 uses: actions/upload-artifact@v7
297 with:
298 name: wsl-node-pty-x64
299 path: wsl-prebuild/pty.node
300 if-no-files-found: error
301​
302 build:
303 name: Build ${{ matrix.label }}
304 # build_wsl_node_pty stays in `needs` so it runs first and its artifact is
305 # available to download, but only the Windows matrix entry consumes it. We
306 # therefore gate the job on preflight + relay (must succeed) WITHOUT requiring
307 # build_wsl_node_pty, so a failed Linux prebuild doesn't skip the macOS/Linux
308 # builds. `!cancelled()` (not `!failure()`) lets the job run even when
309 # build_wsl_node_pty failed; the Windows-only download step below then fails
310 # that single platform if the prebuild is missing.
311 needs: [preflight, relay_public_config, build_wsl_node_pty]
312 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' }}
313 runs-on: ${{ matrix.runner }}
314 timeout-minutes: 30
315 env:
316 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
317 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
318 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
319 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
320 strategy:
321 fail-fast: false
322 matrix:
323 include:
324 - label: macOS arm64
325 runner: blacksmith-12vcpu-macos-26
326 platform: mac
327 target: dmg
328 arch: arm64
329 - label: macOS x64
330 runner: blacksmith-12vcpu-macos-26
331 platform: mac
332 target: dmg
333 arch: x64
334 - label: Linux x64
335 runner: blacksmith-32vcpu-ubuntu-2404
336 platform: linux
337 target: AppImage
338 arch: x64
339 - label: Windows x64
340 runner: blacksmith-32vcpu-windows-2025
341 platform: win
342 target: nsis
343 arch: x64
344 # - label: Windows arm64
345 # runner: windows-11-arm
346 # platform: win
347 # target: nsis
348 # arch: arm64
349 steps:
350 - name: Checkout
351 uses: actions/checkout@v6
352 with:
353 ref: ${{ needs.preflight.outputs.ref }}
354 fetch-depth: 0
355​
356 - name: Setup Vite+
357 uses: voidzero-dev/setup-vp@v1
358 with:
359 node-version-file: package.json
360 cache: true
361 run-install: true
362​
363 - name: Download relay client tracing config
364 uses: actions/download-artifact@v8
365 with:
366 name: relay-client-tracing-config
367 path: ${{ runner.temp }}/relay-client-tracing
368​
369 - name: Load relay client tracing config
370 shell: bash
371 run: |
372 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
373 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
374 echo "::add-mask::$tracing_token"
375 cat "$config_path" >> "$GITHUB_ENV"
376​
377 - name: Align package versions to release version
378 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
379​
380 - name: Download WSL node-pty prebuild
381 if: matrix.platform == 'win'
382 uses: actions/download-artifact@v7
383 with:
384 name: wsl-node-pty-x64
385 path: wsl-prebuild
386​
387 - name: Install Spectre-mitigated MSVC libs
388 if: matrix.platform == 'win'
389 shell: pwsh
390 run: |
391 $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
392 $installPath = & $vswhere -products * -latest -property installationPath
393 $setupExe = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe"
394 $proc = Start-Process -FilePath $setupExe `
395 -ArgumentList "modify", "--installPath", "`"$installPath`"", "--add", `
396 "Microsoft.VisualStudio.Component.VC.Tools.x86.x64.Spectre", "--quiet", "--norestart" `
397 -Wait -PassThru -NoNewWindow
398 if ($null -eq $proc -or $proc.ExitCode -ne 0) {
399 $code = if ($null -ne $proc) { $proc.ExitCode } else { 1 }
400 Write-Error "Visual Studio Installer failed with exit code $code"
401 exit $code
402 }
403​
404 - name: Install ImageMagick
405 if: matrix.platform == 'linux'
406 shell: bash
407 run: |
408 if ! command -v magick >/dev/null 2>&1 && ! command -v convert >/dev/null 2>&1; then
409 sudo apt-get update
410 sudo apt-get install -y imagemagick
411 fi
412​
413 if command -v magick >/dev/null 2>&1; then
414 magick -version
415 else
416 convert -version
417 fi
418​
419 - name: Prepare Azure Trusted Signing
420 if: matrix.platform == 'win'
421 shell: pwsh
422 env:
423 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
424 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
425 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
426 AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
427 AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
428 AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
429 AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
430 run: |
431 $ErrorActionPreference = "Stop"
432​
433 $requiredSecrets = @(
434 $env:AZURE_TENANT_ID,
435 $env:AZURE_CLIENT_ID,
436 $env:AZURE_CLIENT_SECRET,
437 $env:AZURE_TRUSTED_SIGNING_ENDPOINT,
438 $env:AZURE_TRUSTED_SIGNING_ACCOUNT_NAME,
439 $env:AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME,
440 $env:AZURE_TRUSTED_SIGNING_PUBLISHER_NAME
441 )
442 if ($requiredSecrets | Where-Object { [string]::IsNullOrWhiteSpace($_) }) {
443 Write-Host "Azure Trusted Signing disabled; skipping TrustedSigning module preparation."
444 exit 0
445 }
446​
447 try {
448 Install-PackageProvider `
449 -Name NuGet `
450 -MinimumVersion 2.8.5.201 `
451 -Force `
452 -Scope CurrentUser `
453 -ErrorAction Stop
454 } catch {
455 Write-Warning "Could not bootstrap NuGet package provider. Continuing because the runner may already have a usable provider. $($_.Exception.Message)"
456 }
457​
458 Install-Module `
459 -Name TrustedSigning `
460 -MinimumVersion 0.5.0 `
461 -Force `
462 -AllowClobber `
463 -Repository PSGallery `
464 -Scope CurrentUser `
465 -ErrorAction Stop
466​
467 Import-Module TrustedSigning -MinimumVersion 0.5.0 -Force
468 Get-Command Invoke-TrustedSigning -ErrorAction Stop
469​
470 $moduleRoots = @(
471 [System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "PowerShell", "Modules"),
472 [System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "WindowsPowerShell", "Modules"),
473 [System.IO.Path]::Combine($env:ProgramFiles, "PowerShell", "Modules"),
474 [System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules")
475 )
476 $modulePathEntries = @($moduleRoots + ($env:PSModulePath -split ";")) |
477 Where-Object { $_ -and (Test-Path $_) } |
478 Select-Object -Unique
479 "PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
480​
481 - name: Build desktop artifact
482 shell: bash
483 env:
484 CSC_LINK: ${{ secrets.CSC_LINK }}
485 CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
486 APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
487 APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
488 APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
489 APPLE_TEAM_ID: ${{ vars.APPLE_TEAM_ID }}
490 MACOS_PROVISIONING_PROFILE: ${{ secrets.MACOS_PROVISIONING_PROFILE }}
491 T3CODE_CLERK_PASSKEY_RP_DOMAINS: ${{ vars.CLERK_PASSKEY_RP_DOMAINS }}
492 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
493 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
494 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
495 AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
496 AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
497 AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
498 AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
499 run: |
500 args=(
501 --platform "${{ matrix.platform }}"
502 --target "${{ matrix.target }}"
503 --arch "${{ matrix.arch }}"
504 --build-version "${{ needs.preflight.outputs.version }}"
505 --verbose
506 )
507​
508 has_all() {
509 for value in "$@"; do
510 if [[ -z "$value" ]]; then
511 return 1
512 fi
513 done
514 return 0
515 }
516​
517 if [[ "${{ matrix.platform }}" == "mac" ]]; then
518 if has_all "$CSC_LINK" "$CSC_KEY_PASSWORD" "$APPLE_API_KEY" "$APPLE_API_KEY_ID" "$APPLE_API_ISSUER"; then
519 if ! has_all "$APPLE_TEAM_ID" "$MACOS_PROVISIONING_PROFILE"; then
520 echo "macOS signing is configured, but APPLE_TEAM_ID or MACOS_PROVISIONING_PROFILE is missing." >&2
521 exit 1
522 fi
523​
524 key_path="$RUNNER_TEMP/AuthKey_${APPLE_API_KEY_ID}.p8"
525 printf '%s' "$APPLE_API_KEY" > "$key_path"
526 export APPLE_API_KEY="$key_path"
527​
528 profile_path="$RUNNER_TEMP/t3code.provisionprofile"
529 printf '%s' "$MACOS_PROVISIONING_PROFILE" | base64 -D > "$profile_path"
530 security cms -D -i "$profile_path" >/dev/null
531 export T3CODE_APPLE_TEAM_ID="$APPLE_TEAM_ID"
532 export T3CODE_MACOS_PROVISIONING_PROFILE="$profile_path"
533​
534 echo "macOS signing enabled."
535 args+=(--signed)
536 else
537 echo "macOS signing disabled (missing one or more Apple signing secrets)."
538 fi
539 elif [[ "${{ matrix.platform }}" == "win" ]]; then
540 # Bundle the Linux node-pty binary built by the build_wsl_node_pty job
541 # so the packaged WSL backend ships a ready binary (no first-launch
542 # compile). Required for a working WSL backend on Windows.
543 args+=(--wsl-prebuild "$GITHUB_WORKSPACE/wsl-prebuild/pty.node")
544 if has_all \
545 "$AZURE_TENANT_ID" \
546 "$AZURE_CLIENT_ID" \
547 "$AZURE_CLIENT_SECRET" \
548 "$AZURE_TRUSTED_SIGNING_ENDPOINT" \
549 "$AZURE_TRUSTED_SIGNING_ACCOUNT_NAME" \
550 "$AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME" \
551 "$AZURE_TRUSTED_SIGNING_PUBLISHER_NAME"; then
552 echo "Windows signing enabled (Azure Trusted Signing)."
553 args+=(--signed)
554 else
555 echo "Windows signing disabled (missing one or more Azure Trusted Signing secrets)."
556 fi
557 else
558 echo "Signing disabled for ${{ matrix.platform }}."
559 fi
560​
561 vp run dist:desktop:artifact "${args[@]}"
562​
563 - name: Collect release assets
564 shell: bash
565 run: |
566 set -euo pipefail
567 mkdir -p release-publish
568​
569 shopt -s nullglob
570 for pattern in \
571 "release/*.dmg" \
572 "release/*.zip" \
573 "release/*.AppImage" \
574 "release/*.exe" \
575 "release/*.blockmap" \
576 "release/*.yml"; do
577 for file in $pattern; do
578 cp "$file" release-publish/
579 done
580 done
581​
582 if [[ "${{ matrix.platform }}" == "mac" && "${{ matrix.arch }}" != "arm64" ]]; then
583 shopt -s nullglob
584 for manifest in release-publish/*-mac.yml; do
585 mv "$manifest" "${manifest%.yml}-${{ matrix.arch }}.yml"
586 done
587 fi
588​
589 # Enable if Windows arm64 builds are enabled.
590 # Windows updater metadata is channel-specific (for example
591 # "latest.yml" or "nightly.yml"). Suffix each per-arch copy so the
592 # release job can merge matching arm64/x64 manifests back into one
593 # canonical manifest per channel.
594 # if [[ "${{ matrix.platform }}" == "win" ]]; then
595 # shopt -s nullglob
596 # for manifest in release-publish/*.yml; do
597 # mv "$manifest" "${manifest%.yml}-win-${{ matrix.arch }}.yml"
598 # done
599 # fi
600​
601 - name: Upload build artifacts
602 uses: actions/upload-artifact@v7
603 with:
604 name: desktop-${{ matrix.platform }}-${{ matrix.arch }}
605 path: release-publish/*
606 if-no-files-found: error
607​
608 publish_cli:
609 name: Publish CLI to npm
610 needs: [preflight, relay_public_config, build]
611 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build.result == 'success' }}
612 runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
613 timeout-minutes: 10
614 permissions:
615 contents: read
616 id-token: write
617 env:
618 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
619 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
620 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
621 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
622 steps:
623 - name: Checkout
624 uses: actions/checkout@v6
625 with:
626 ref: ${{ needs.preflight.outputs.ref }}
627​
628 - name: Setup Vite+
629 uses: voidzero-dev/setup-vp@v1
630 with:
631 node-version-file: package.json
632 cache: true
633 run-install: |
634 args:
635 - --filter=t3...
636 - --filter=@t3tools/web...
637 - --filter=@t3tools/scripts...
638​
639 - name: Download relay client tracing config
640 uses: actions/download-artifact@v8
641 with:
642 name: relay-client-tracing-config
643 path: ${{ runner.temp }}/relay-client-tracing
644​
645 - name: Load relay client tracing config
646 shell: bash
647 run: |
648 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
649 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
650 echo "::add-mask::$tracing_token"
651 cat "$config_path" >> "$GITHUB_ENV"
652​
653 - name: Align package versions to release version
654 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
655​
656 - name: Build web package
657 run: vp run --filter @t3tools/web build
658​
659 - name: Build CLI package
660 run: vp run --filter t3 build
661​
662 - name: Publish CLI package
663 run: node apps/server/scripts/cli.ts publish --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --app-version "${{ needs.preflight.outputs.version }}" --verbose
664​
665 release:
666 name: Publish GitHub Release
667 needs: [preflight, build, publish_cli]
668 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build.result == 'success' && needs.publish_cli.result == 'success' }}
669 runs-on: blacksmith-8vcpu-ubuntu-2404
670 timeout-minutes: 10
671 steps:
672 - id: app_token
673 name: Mint release app token
674 uses: actions/create-github-app-token@v2
675 with:
676 app-id: ${{ secrets.RELEASE_APP_ID }}
677 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
678 owner: ${{ github.repository_owner }}
679​
680 - name: Checkout
681 uses: actions/checkout@v6
682 with:
683 ref: ${{ needs.preflight.outputs.ref }}
684​
685 - name: Setup Vite+
686 uses: voidzero-dev/setup-vp@v1
687 with:
688 node-version-file: package.json
689 cache: true
690 run-install: |
691 args:
692 - --filter=@t3tools/scripts...
693​
694 - name: Download all desktop artifacts
695 uses: actions/download-artifact@v8
696 with:
697 pattern: desktop-*
698 merge-multiple: true
699 path: release-assets
700​
701 - name: Merge macOS updater manifests
702 run: |
703 shopt -s nullglob
704 for x64_manifest in release-assets/*-mac-x64.yml; do
705 arm64_manifest="${x64_manifest%-x64.yml}.yml"
706 if [[ -f "$arm64_manifest" ]]; then
707 node scripts/merge-update-manifests.ts --platform mac "$arm64_manifest" "$x64_manifest"
708 rm -f "$x64_manifest"
709 fi
710 done
711​
712 # - name: Merge Windows updater manifests
713 # run: |
714 # shopt -s nullglob
715 # found_windows_manifest=false
716 # for x64_manifest in release-assets/*-win-x64.yml; do
717 # if [[ "$(basename "$x64_manifest")" == builder-debug-* ]]; then
718 # continue
719 # fi
720​
721 # arm64_manifest="${x64_manifest/-x64.yml/-arm64.yml}"
722 # output_manifest="${x64_manifest/-win-x64.yml/.yml}"
723 # if [[ ! -f "$arm64_manifest" ]]; then
724 # echo "Missing matching arm64 Windows manifest for $x64_manifest" >&2
725 # exit 1
726 # fi
727​
728 # found_windows_manifest=true
729 # node scripts/merge-update-manifests.ts --platform win \
730 # "$arm64_manifest" \
731 # "$x64_manifest" \
732 # "$output_manifest"
733 # rm -f "$arm64_manifest" "$x64_manifest"
734 # done
735​
736 # if [[ "$found_windows_manifest" != true ]]; then
737 # echo "No Windows updater manifests found to merge." >&2
738 # exit 1
739 # fi
740​
741 - name: Publish release
742 if: needs.preflight.outputs.previous_tag != ''
743 uses: softprops/action-gh-release@v2
744 with:
745 tag_name: ${{ needs.preflight.outputs.tag }}
746 target_commitish: ${{ needs.preflight.outputs.ref }}
747 name: ${{ needs.preflight.outputs.release_name }}
748 generate_release_notes: true
749 previous_tag: ${{ needs.preflight.outputs.previous_tag }}
750 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
751 make_latest: ${{ needs.preflight.outputs.make_latest }}
752 files: |
753 release-assets/*.dmg
754 release-assets/*.zip
755 release-assets/*.AppImage
756 release-assets/*.exe
757 release-assets/*.blockmap
758 release-assets/*.yml
759 fail_on_unmatched_files: true
760 token: ${{ steps.app_token.outputs.token }}
761​
762 - name: Publish first release
763 if: needs.preflight.outputs.previous_tag == ''
764 uses: softprops/action-gh-release@v2
765 with:
766 tag_name: ${{ needs.preflight.outputs.tag }}
767 target_commitish: ${{ needs.preflight.outputs.ref }}
768 name: ${{ needs.preflight.outputs.release_name }}
769 generate_release_notes: true
770 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
771 make_latest: ${{ needs.preflight.outputs.make_latest }}
772 files: |
773 release-assets/*.dmg
774 release-assets/*.zip
775 release-assets/*.AppImage
776 release-assets/*.exe
777 release-assets/*.blockmap
778 release-assets/*.yml
779 fail_on_unmatched_files: true
780 token: ${{ steps.app_token.outputs.token }}
781​
782 deploy_web:
783 name: Deploy hosted web app
784 needs: [preflight, relay_public_config, release]
785 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.release.result == 'success' }}
786 runs-on: blacksmith-8vcpu-ubuntu-2404
787 timeout-minutes: 10
788 env:
789 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
790 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
791 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
792 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
793 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
794 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
795 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
796 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
797 T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
798 T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
799 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
800 steps:
801 - name: Checkout
802 uses: actions/checkout@v6
803 with:
804 ref: ${{ needs.preflight.outputs.ref }}
805​
806 - name: Setup Vite+
807 uses: voidzero-dev/setup-vp@v1
808 with:
809 node-version-file: package.json
810 cache: true
811 run-install: |
812 args:
813 - --filter=@t3tools/scripts...
814 - --filter=@t3tools/web...
815​
816 - name: Download relay client tracing config
817 uses: actions/download-artifact@v8
818 with:
819 name: relay-client-tracing-config
820 path: ${{ runner.temp }}/relay-client-tracing
821​
822 - name: Load relay client tracing config
823 shell: bash
824 run: |
825 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
826 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
827 echo "::add-mask::$tracing_token"
828 cat "$config_path" >> "$GITHUB_ENV"
829​
830 - name: Align package versions to release version
831 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
832​
833 - name: Refresh release lockfile
834 run: vp install --lockfile-only --ignore-scripts
835​
836 - name: Deploy and alias channel
837 shell: bash
838 run: |
839 set -euo pipefail
840​
841 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" || -z "${VERCEL_PROJECT_ID:-}" ]]; then
842 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID." >&2
843 exit 1
844 fi
845​
846 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
847 latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
848 nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
849 router_domain="${router_url#http://}"
850 router_domain="${router_domain#https://}"
851 router_domain="${router_domain%%/*}"
852​
853 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
854 channel_domain="$latest_domain"
855 channel_name="latest"
856 else
857 channel_domain="$nightly_domain"
858 channel_name="nightly"
859 fi
860​
861 vercel_scope="${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
862 vercel_scope_args=(--scope "$vercel_scope")
863​
864 echo "Deploying hosted web app for $channel_name channel."
865 deployment_url="$(
866 vp dlx vercel@53.1.1 deploy \
867 --prod \
868 --skip-domain \
869 --yes \
870 --token "$VERCEL_TOKEN" \
871 "${vercel_scope_args[@]}" \
872 --build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
873 --build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
874 --build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
875 --build-env "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID=${T3CODE_CLERK_CLI_OAUTH_CLIENT_ID:-}" \
876 --build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
877 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=${T3CODE_RELAY_CLIENT_OTLP_TRACES_URL:-}" \
878 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=${T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET:-}" \
879 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=${T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN:-}" \
880 --build-env "VITE_HOSTED_APP_URL=$router_url" \
881 --build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
882 )"
883​
884 echo "Aliasing $deployment_url to $channel_domain."
885 vp dlx vercel@53.1.1 alias set "$deployment_url" "$channel_domain" \
886 --token "$VERCEL_TOKEN" \
887 "${vercel_scope_args[@]}"
888​
889 if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
890 echo "Aliasing $deployment_url to router domain $router_domain."
891 vp dlx vercel@53.1.1 alias set "$deployment_url" "$router_domain" \
892 --token "$VERCEL_TOKEN" \
893 "${vercel_scope_args[@]}"
894 fi
895​
896 finalize:
897 name: Finalize release
898 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
899 needs: [preflight, release]
900 runs-on: blacksmith-8vcpu-ubuntu-2404
901 timeout-minutes: 10
902 steps:
903 - id: app_token
904 name: Mint release app token
905 uses: actions/create-github-app-token@v2
906 with:
907 app-id: ${{ secrets.RELEASE_APP_ID }}
908 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
909 owner: ${{ github.repository_owner }}
910​
911 - name: Checkout
912 uses: actions/checkout@v6
913 with:
914 ref: main
915 fetch-depth: 0
916 token: ${{ steps.app_token.outputs.token }}
917 persist-credentials: true
918​
919 - id: app_bot
920 name: Resolve GitHub App bot identity
921 env:
922 GH_TOKEN: ${{ steps.app_token.outputs.token }}
923 APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
924 run: |
925 user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
926 echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
927 echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
928​
929 - name: Setup Vite+
930 uses: voidzero-dev/setup-vp@v1
931 with:
932 node-version-file: package.json
933 cache: true
934 run-install: |
935 args:
936 - --filter=@t3tools/scripts...
937 - --filter=@t3tools/oxlint-plugin-t3code...
938​
939 - id: update_versions
940 name: Update version strings
941 env:
942 RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
943 run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
944​
945 - name: Format package.json files
946 if: steps.update_versions.outputs.changed == 'true'
947 run: vp fmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
948​
949 - name: Refresh lockfile
950 if: steps.update_versions.outputs.changed == 'true'
951 run: vp install --lockfile-only --ignore-scripts
952​
953 - name: Commit and push version bump
954 if: steps.update_versions.outputs.changed == 'true'
955 shell: bash
956 env:
957 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
958 run: |
959 if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml; then
960 echo "No version changes to commit."
961 exit 0
962 fi
963​
964 git config user.name "${{ steps.app_bot.outputs.name }}"
965 git config user.email "${{ steps.app_bot.outputs.email }}"
966​
967 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
968 git commit -m "chore(release): prepare $RELEASE_TAG"
969 git push origin HEAD:main
970​
971 announce_discord:
972 name: Announce release on Discord
973 if: |
974 always() && !cancelled() &&
975 needs.preflight.result == 'success' &&
976 needs.relay_public_config.result == 'success' &&
977 needs.release.result == 'success' &&
978 needs.deploy_web.result == 'success' &&
979 (needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
980 needs: [preflight, relay_public_config, release, deploy_web, finalize]
981 runs-on: blacksmith-8vcpu-ubuntu-2404
982 timeout-minutes: 10
983 steps:
984 - name: Checkout
985 uses: actions/checkout@v6
986 with:
987 ref: ${{ needs.preflight.outputs.ref }}
988​
989 - name: Setup Vite+
990 uses: voidzero-dev/setup-vp@v1
991 with:
992 node-version-file: package.json
993 cache: true
994 run-install: |
995 args:
996 - --filter=@t3tools/scripts...
997​
998 - name: Announce prerelease on Discord
999 if: needs.preflight.outputs.is_prerelease == 'true'
1000 continue-on-error: true
1001 env:
1002 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_NIGHTLY_ROLE_ID }}
1003 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1004 run: |
1005 node scripts/notify-discord-release.ts prerelease \
1006 --role-id "$DISCORD_MENTION_ROLE_ID" \
1007 --release-name "${{ needs.preflight.outputs.release_name }}" \
1008 --release-version "${{ needs.preflight.outputs.version }}" \
1009 --tag "${{ needs.preflight.outputs.tag }}" \
1010 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"
1011​
1012 - name: Announce latest release on Discord
1013 if: needs.preflight.outputs.make_latest == 'true'
1014 continue-on-error: true
1015 env:
1016 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_LATEST_ROLE_ID }}
1017 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1018 run: |
1019 node scripts/notify-discord-release.ts latest \
1020 --role-id "$DISCORD_MENTION_ROLE_ID" \
1021 --release-name "${{ needs.preflight.outputs.release_name }}" \
1022 --release-version "${{ needs.preflight.outputs.version }}" \
1023 --tag "${{ needs.preflight.outputs.tag }}" \
1024 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"