Open History to see the last commit
1name: Release
2
3on:
4 push:
5 tags:
6 - "v*.*.*"
7 - "!v*-nightly.*"
8 schedule:
9 # Avoid minute zero, when GitHub scheduled jobs are busiest.
10 - cron: "8,38 * * * *"
11 workflow_dispatch:
12 inputs:
13 channel:
14 description: "Release channel"
15 required: false
16 default: stable
17 type: choice
18 options:
19 - stable
20 - nightly
21 version:
22 description: "Stable version override (for example 1.2.3). Defaults to the version the latest nightly previewed."
23 required: false
24 type: string
25
26# Serialize nightlies (scheduled and manual) so overlapping runs cannot build
27# the same commit twice or publish out of order. Stable tag releases get their
28# own group so a nightly never blocks them. Running publishers are never
29# canceled, and queue: max keeps every pending run instead of the default
30# newest-wins single slot, so a queued stable tag can never be silently
31# dropped. Automatic nightlies recheck the release gap after leaving the queue.
32concurrency:
33 group: release-${{ (github.event_name == 'schedule' || inputs.channel == 'nightly') && 'nightly' || 'stable' }}
34 cancel-in-progress: false
35 queue: max
36
37permissions:
38 contents: read
39 id-token: none
40
41jobs:
42 # Picks the commit every later job builds. Nightlies and tag pushes build the
43 # triggering commit. Manual stable releases build the commit of the latest
44 # published nightly, so stable only ever ships a build that nightly users
45 # have already run. Scheduled runs also decide here whether a nightly is due.
46 resolve_commit:
47 name: Resolve release commit
48 runs-on: blacksmith-8vcpu-ubuntu-2404
49 timeout-minutes: 5
50 outputs:
51 ref: ${{ steps.resolve.outputs.ref }}
52 nightly_version: ${{ steps.resolve.outputs.nightly_version }}
53 has_changes: ${{ steps.resolve.outputs.has_changes }}
54 steps:
55 - name: Checkout
56 uses: actions/checkout@v6
57 with:
58 sparse-checkout: .github/scripts
59
60 - id: resolve
61 name: Resolve release commit
62 uses: actions/github-script@v8
63 env:
64 DISPATCH_CHANNEL: ${{ inputs.channel }}
65 with:
66 script: |
67 const {
68 shouldReleaseNightly,
69 resolveLatestNightlyCommit,
70 } = require('./.github/scripts/check-nightly-release.cjs');
71
72 if (context.eventName === 'schedule') {
73 core.setOutput('has_changes', await shouldReleaseNightly({ github, context, core }));
74 core.setOutput('ref', context.sha);
75 } else if (context.eventName === 'workflow_dispatch' && process.env.DISPATCH_CHANNEL !== 'nightly') {
76 const { tag, sha, version } = await resolveLatestNightlyCommit({ github, context, core });
77 core.notice(`Stable release builds ${sha}, the commit shipped by ${tag}.`);
78 core.setOutput('ref', sha);
79 core.setOutput('nightly_version', version);
80 } else {
81 core.setOutput('ref', context.sha);
82 }
83
84 preflight:
85 name: Preflight
86 needs: [resolve_commit]
87 if: |
88 needs.resolve_commit.result == 'success' &&
89 (github.event_name != 'schedule' || needs.resolve_commit.outputs.has_changes == 'true')
90 runs-on: blacksmith-8vcpu-ubuntu-2404
91 timeout-minutes: 10
92 outputs:
93 release_channel: ${{ steps.release_meta.outputs.release_channel }}
94 version: ${{ steps.release_meta.outputs.version }}
95 tag: ${{ steps.release_meta.outputs.tag }}
96 release_name: ${{ steps.release_meta.outputs.name }}
97 short_sha: ${{ steps.release_meta.outputs.short_sha }}
98 previous_tag: ${{ steps.previous_tag.outputs.previous_tag }}
99 cli_dist_tag: ${{ steps.release_meta.outputs.cli_dist_tag }}
100 is_prerelease: ${{ steps.release_meta.outputs.is_prerelease }}
101 make_latest: ${{ steps.release_meta.outputs.make_latest }}
102 ref: ${{ needs.resolve_commit.outputs.ref }}
103 steps:
104 - name: Checkout
105 uses: actions/checkout@v6
106 with:
107 ref: ${{ needs.resolve_commit.outputs.ref }}
108 fetch-depth: 0
109 sparse-checkout: |
110 /*
111 !/.repos/
112 sparse-checkout-cone-mode: false
113
114 - name: Setup Vite+
115 uses: voidzero-dev/setup-vp@v1
116 with:
117 node-version-file: package.json
118 cache: true
119 run-install: true
120 env:
121 pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
122
123 - id: release_meta
124 name: Resolve release version
125 shell: bash
126 env:
127 DISPATCH_CHANNEL: ${{ github.event.inputs.channel }}
128 DISPATCH_VERSION: ${{ github.event.inputs.version }}
129 NIGHTLY_VERSION: ${{ needs.resolve_commit.outputs.nightly_version }}
130 NIGHTLY_DATE: ${{ github.run_started_at }}
131 NIGHTLY_SHA: ${{ needs.resolve_commit.outputs.ref }}
132 NIGHTLY_RUN_NUMBER: ${{ github.run_number }}
133 run: |
134 if [[ "${GITHUB_EVENT_NAME}" == "schedule" || ( "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-stable}" == "nightly" ) ]]; then
135 nightly_date="$(date -u -d "$NIGHTLY_DATE" +%Y%m%d)"
136
137 node scripts/resolve-nightly-release.ts \
138 --date "$nightly_date" \
139 --run-number "$NIGHTLY_RUN_NUMBER" \
140 --sha "$NIGHTLY_SHA" \
141 --github-output
142
143 echo "release_channel=nightly" >> "$GITHUB_OUTPUT"
144 echo "cli_dist_tag=nightly" >> "$GITHUB_OUTPUT"
145 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
146 echo "make_latest=false" >> "$GITHUB_OUTPUT"
147 else
148 if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
149 raw="${DISPATCH_VERSION:-$NIGHTLY_VERSION}"
150 if [[ -z "$raw" ]]; then
151 echo "workflow_dispatch stable releases need a version input or a published nightly." >&2
152 exit 1
153 fi
154 else
155 raw="${GITHUB_REF_NAME}"
156 fi
157
158 version="${raw#v}"
159 if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
160 echo "Invalid release version: $raw" >&2
161 exit 1
162 fi
163
164 echo "release_channel=stable" >> "$GITHUB_OUTPUT"
165 echo "version=$version" >> "$GITHUB_OUTPUT"
166 echo "tag=v$version" >> "$GITHUB_OUTPUT"
167 echo "name=T3 Code v$version" >> "$GITHUB_OUTPUT"
168 echo "cli_dist_tag=latest" >> "$GITHUB_OUTPUT"
169 if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
170 echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
171 echo "make_latest=true" >> "$GITHUB_OUTPUT"
172 else
173 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
174 echo "make_latest=false" >> "$GITHUB_OUTPUT"
175 fi
176 fi
177
178 - id: previous_tag
179 name: Resolve previous release tag
180 run: |
181 node scripts/resolve-previous-release-tag.ts \
182 --channel "${{ steps.release_meta.outputs.release_channel }}" \
183 --current-tag "${{ steps.release_meta.outputs.tag }}" \
184 --github-output
185
186 # Share only the verification results, not the large registry metadata cache.
187 - name: Upload dependency verification
188 continue-on-error: true
189 uses: actions/upload-artifact@v7
190 with:
191 name: release-dependency-verification
192 path: ${{ runner.temp }}/pnpm-metadata/lockfile-verified.jsonl
193
194 quality:
195 name: Release quality checks
196 needs: [preflight]
197 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
198 runs-on: blacksmith-8vcpu-ubuntu-2404
199 timeout-minutes: 10
200 steps:
201 - name: Checkout
202 uses: actions/checkout@v6
203 with:
204 ref: ${{ needs.preflight.outputs.ref }}
205 sparse-checkout: |
206 /*
207 !/.repos/
208 sparse-checkout-cone-mode: false
209
210 - name: Setup Vite+
211 uses: voidzero-dev/setup-vp@v1
212 with:
213 node-version-file: package.json
214 cache: true
215 run-install: true
216
217 - name: Ensure Electron runtime is installed
218 run: vp run --filter @t3tools/desktop ensure:electron
219
220 - name: Check
221 run: vp check
222
223 - name: Typecheck
224 run: vp run typecheck
225
226 - uses: ./.github/actions/setup-apt-mirrors
227
228 - name: Install browser secret helper build libraries
229 run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
230
231 - name: Test
232 run: vp run test
233
234 relay_public_config:
235 name: Resolve T3 Connect public config
236 # Consumes only the release commit, not preflight's resolved version, so it
237 # runs alongside preflight instead of after it. The condition mirrors preflight's.
238 needs: [resolve_commit]
239 if: |
240 needs.resolve_commit.result == 'success' &&
241 (github.event_name != 'schedule' || needs.resolve_commit.outputs.has_changes == 'true')
242 runs-on: blacksmith-8vcpu-ubuntu-2404
243 timeout-minutes: 5
244 environment:
245 name: production
246 outputs:
247 clerk_publishable_key: ${{ steps.public_config.outputs.clerk_publishable_key }}
248 clerk_jwt_template: ${{ steps.public_config.outputs.clerk_jwt_template }}
249 clerk_cli_oauth_client_id: ${{ steps.public_config.outputs.clerk_cli_oauth_client_id }}
250 relay_url: ${{ steps.public_config.outputs.relay_url }}
251 env:
252 CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
253 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
254 RELAY_DOMAIN: ${{ vars.RELAY_DOMAIN }}
255 RELAY_API_ZONE_NAME: ${{ vars.RELAY_API_ZONE_NAME }}
256 CLERK_PUBLISHABLE_KEY: ${{ vars.CLERK_PUBLISHABLE_KEY }}
257 CLERK_JWT_TEMPLATE: ${{ vars.CLERK_JWT_TEMPLATE }}
258 CLERK_CLI_OAUTH_CLIENT_ID: ${{ vars.CLERK_CLI_OAUTH_CLIENT_ID }}
259 steps:
260 - name: Checkout
261 uses: actions/checkout@v6
262 with:
263 ref: ${{ needs.resolve_commit.outputs.ref }}
264 sparse-checkout: |
265 /*
266 !/.repos/
267 sparse-checkout-cone-mode: false
268
269 - name: Setup Vite+
270 uses: voidzero-dev/setup-vp@v1
271 with:
272 node-version-file: package.json
273 cache: true
274 run-install: |
275 args:
276 - --filter=t3code-relay...
277
278 - id: relay_state
279 name: Read production relay tracing config
280 shell: bash
281 run: |
282 vp run --filter t3code-relay deploy \
283 --stage prod \
284 --read-state \
285 --github-output \
286 --github-env-file "$RUNNER_TEMP/relay-client-tracing.env"
287
288 - name: Upload relay client tracing config
289 uses: actions/upload-artifact@v7
290 with:
291 name: relay-client-tracing-config
292 path: ${{ runner.temp }}/relay-client-tracing.env
293 if-no-files-found: error
294 retention-days: 1
295
296 - id: public_config
297 name: Resolve production relay public config
298 shell: bash
299 run: |
300 set -euo pipefail
301
302 relay_domain="${RELAY_DOMAIN:-}"
303 if [[ -z "$relay_domain" && -n "${RELAY_API_ZONE_NAME:-}" ]]; then
304 relay_domain="relay.$RELAY_API_ZONE_NAME"
305 fi
306 required=(
307 relay_domain
308 CLERK_PUBLISHABLE_KEY
309 CLERK_JWT_TEMPLATE
310 CLERK_CLI_OAUTH_CLIENT_ID
311 )
312 missing=()
313 for name in "${required[@]}"; do
314 if [[ -z "${!name:-}" ]]; then
315 missing+=("$name")
316 fi
317 done
318 if (( ${#missing[@]} > 0 )); then
319 printf 'Missing required relay deployment configuration: %s\n' "${missing[*]}" >&2
320 exit 1
321 fi
322
323 echo "clerk_publishable_key=$CLERK_PUBLISHABLE_KEY" >> "$GITHUB_OUTPUT"
324 echo "clerk_jwt_template=$CLERK_JWT_TEMPLATE" >> "$GITHUB_OUTPUT"
325 echo "clerk_cli_oauth_client_id=$CLERK_CLI_OAUTH_CLIENT_ID" >> "$GITHUB_OUTPUT"
326 echo "relay_url=https://$relay_domain" >> "$GITHUB_OUTPUT"
327
328 # node-pty publishes no Linux prebuilt and the WSL backend runs under the
329 # distro's own (Linux) Node, which can't load the Windows/Electron binary. We
330 # build the Linux pty.node here, on Linux, and hand it to the Windows packaging
331 # job — the Windows artifact then ships a ready WSL backend binary with no
332 # cross-compiling and no first-launch compiler/node-gyp/network on the user's
333 # machine. node-pty is N-API, so one binary works across all WSL Node versions.
334 build_wsl_node_pty:
335 name: Build WSL node-pty (linux-x64)
336 # Same gating as relay_public_config: only the release commit is needed, so
337 # this runs alongside preflight. See the condition comment there.
338 needs: [resolve_commit]
339 if: |
340 needs.resolve_commit.result == 'success' &&
341 (github.event_name != 'schedule' || needs.resolve_commit.outputs.has_changes == 'true')
342 runs-on: blacksmith-8vcpu-ubuntu-2404
343 timeout-minutes: 15
344 steps:
345 - name: Checkout
346 uses: actions/checkout@v6
347 with:
348 ref: ${{ needs.resolve_commit.outputs.ref }}
349 sparse-checkout: |
350 /*
351 !/.repos/
352 sparse-checkout-cone-mode: false
353
354 - name: Setup Vite+
355 uses: voidzero-dev/setup-vp@v1
356 with:
357 node-version-file: package.json
358 cache: true
359 run-install: |
360 args:
361 - --filter=t3...
362
363 - name: Build node-pty linux-x64 prebuild
364 shell: bash
365 run: |
366 set -euo pipefail
367 # Resolve node-pty from apps/server (where it's a dependency) and build
368 # its native binary from source for Linux. node-addon-api resolves from
369 # node-pty's own dependency tree, so node-gyp has everything it needs.
370 pty_pkg="$(node -e "console.log(require.resolve('node-pty/package.json', { paths: ['$GITHUB_WORKSPACE/apps/server'] }))")"
371 pty_dir="$(dirname "$pty_pkg")"
372 ( cd "$pty_dir" && npx --yes node-gyp rebuild )
373 mkdir -p wsl-prebuild
374 cp "$pty_dir/build/Release/pty.node" wsl-prebuild/pty.node
375 file wsl-prebuild/pty.node
376
377 - name: Upload node-pty linux-x64 prebuild
378 uses: actions/upload-artifact@v7
379 with:
380 name: wsl-node-pty-x64
381 path: wsl-prebuild/pty.node
382 if-no-files-found: error
383
384 build:
385 name: Build ${{ matrix.label }}
386 # build_wsl_node_pty stays in `needs` so it runs first and its artifact is
387 # available to download, but only the Windows matrix entry consumes it. We
388 # therefore gate the job on preflight + relay (must succeed) WITHOUT requiring
389 # build_wsl_node_pty, so a failed Linux prebuild doesn't skip the macOS/Linux
390 # builds. `!cancelled()` (not `!failure()`) lets the job run even when
391 # build_wsl_node_pty failed; the Windows-only download step below then fails
392 # that single platform if the prebuild is missing.
393 needs: [preflight, relay_public_config, build_wsl_node_pty]
394 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' }}
395 runs-on: ${{ matrix.runner }}
396 timeout-minutes: 30
397 env:
398 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
399 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
400 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
401 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
402 strategy:
403 fail-fast: false
404 matrix:
405 include:
406 - label: macOS arm64
407 runner: blacksmith-12vcpu-macos-26
408 platform: mac
409 target: dmg
410 arch: arm64
411 rust_target: aarch64-apple-darwin
412 resource_key: darwin-arm64
413 - label: macOS x64
414 runner: blacksmith-12vcpu-macos-26
415 platform: mac
416 target: dmg
417 arch: x64
418 rust_target: x86_64-apple-darwin
419 resource_key: darwin-x64
420 - label: Linux x64
421 runner: blacksmith-32vcpu-ubuntu-2404
422 platform: linux
423 target: AppImage
424 arch: x64
425 rust_target: x86_64-unknown-linux-gnu
426 resource_key: linux-x64
427 - label: Windows x64
428 runner: blacksmith-32vcpu-windows-2025
429 platform: win
430 target: nsis
431 arch: x64
432 rust_target: x86_64-pc-windows-msvc
433 resource_key: win32-x64
434 # - label: Windows arm64
435 # runner: windows-11-arm
436 # platform: win
437 # target: nsis
438 # arch: arm64
439 steps:
440 - name: Checkout
441 uses: actions/checkout@v6
442 with:
443 ref: ${{ needs.preflight.outputs.ref }}
444 sparse-checkout: |
445 /*
446 !/.repos/
447 sparse-checkout-cone-mode: false
448
449 - name: Setup Vite+
450 uses: voidzero-dev/setup-vp@v1
451 with:
452 node-version-file: package.json
453 cache: ${{ matrix.platform != 'win' }}
454 run-install: false
455
456 - name: Resolve Windows package cache path
457 if: matrix.platform == 'win'
458 id: package_cache_path
459 shell: pwsh
460 run: '"path=$(vp pm cache dir)" >> $env:GITHUB_OUTPUT'
461
462 - name: Cache Windows packages
463 if: matrix.platform == 'win'
464 uses: actions/cache@v6
465 with:
466 path: ${{ steps.package_cache_path.outputs.path }}
467 key: windows-release-packages-v1-${{ matrix.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
468
469 # pnpm checks the lockfile and policy before reusing this result. A missing
470 # artifact leaves the cache empty, so installation runs the checks again.
471 - name: Download dependency verification
472 continue-on-error: true
473 uses: actions/download-artifact@v8
474 with:
475 name: release-dependency-verification
476 path: ${{ runner.temp }}/pnpm-metadata
477
478 - name: Install desktop dependencies
479 env:
480 pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
481 run: vp install --filter=@t3tools/desktop... --filter=t3... --filter=@t3tools/scripts...
482
483 - name: Cache resource monitor
484 id: resource_monitor_cache
485 uses: actions/cache@v6
486 with:
487 path: native/resource-monitor/target/${{ matrix.rust_target }}/release/t3-resource-monitor${{ matrix.platform == 'win' && '.exe' || '' }}
488 key: resource-monitor-${{ matrix.rust_target }}-${{ hashFiles('native/resource-monitor/Cargo.lock', 'native/resource-monitor/Cargo.toml', 'native/resource-monitor/src/**') }}
489
490 - name: Cache Linux capture helpers
491 if: matrix.platform == 'linux'
492 id: capture_helper_cache
493 uses: actions/cache@v6
494 with:
495 path: |
496 native/kde-snap-shot/target/${{ matrix.rust_target }}/release/t3-kde-snap-shot
497 native/hyprland-snap-shot/target/${{ matrix.rust_target }}/release/t3-hyprland-snap-shot
498 key: linux-capture-helpers-${{ matrix.rust_target }}-${{ hashFiles('native/kde-snap-shot/Cargo.lock', 'native/kde-snap-shot/Cargo.toml', 'native/kde-snap-shot/src/**', 'native/hyprland-snap-shot/Cargo.lock', 'native/hyprland-snap-shot/Cargo.toml', 'native/hyprland-snap-shot/src/**', 'native/hyprland-snap-shot/protocols/**') }}
499
500 - name: Setup Rust
501 if: steps.resource_monitor_cache.outputs.cache-hit != 'true' || (matrix.platform == 'linux' && steps.capture_helper_cache.outputs.cache-hit != 'true')
502 uses: dtolnay/rust-toolchain@stable
503 with:
504 targets: ${{ matrix.rust_target }}
505
506 - name: Download relay client tracing config
507 uses: actions/download-artifact@v8
508 with:
509 name: relay-client-tracing-config
510 path: ${{ runner.temp }}/relay-client-tracing
511
512 - name: Load relay client tracing config
513 shell: bash
514 run: |
515 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
516 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
517 echo "::add-mask::$tracing_token"
518 cat "$config_path" >> "$GITHUB_ENV"
519
520 - name: Align package versions to release version
521 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
522
523 - name: Download WSL node-pty prebuild
524 if: matrix.platform == 'win'
525 uses: actions/download-artifact@v7
526 with:
527 name: wsl-node-pty-x64
528 path: wsl-prebuild
529
530 - name: Install Spectre-mitigated MSVC libs
531 if: matrix.platform == 'win'
532 shell: pwsh
533 run: |
534 $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
535 $installPath = & $vswhere -products * -latest -property installationPath
536 $setupExe = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe"
537 $proc = Start-Process -FilePath $setupExe `
538 -ArgumentList "modify", "--installPath", "`"$installPath`"", "--add", `
539 "Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre", "--quiet", "--norestart" `
540 -Wait -PassThru -NoNewWindow
541 if ($null -eq $proc -or $proc.ExitCode -ne 0) {
542 $code = if ($null -ne $proc) { $proc.ExitCode } else { 1 }
543 Write-Error "Visual Studio Installer failed with exit code $code"
544 exit $code
545 }
546
547 - uses: ./.github/actions/setup-apt-mirrors
548 if: matrix.platform == 'linux'
549
550 - name: Install Linux desktop build libraries
551 if: matrix.platform == 'linux'
552 shell: bash
553 run: |
554 sudo apt-get update
555 sudo apt-get install -y libsecret-1-dev pkg-config
556 if ! command -v magick >/dev/null 2>&1 && ! command -v convert >/dev/null 2>&1; then
557 sudo apt-get install -y imagemagick
558 fi
559
560 if command -v magick >/dev/null 2>&1; then
561 magick -version
562 else
563 convert -version
564 fi
565
566 - name: Prepare Azure Trusted Signing
567 if: matrix.platform == 'win'
568 shell: pwsh
569 env:
570 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
571 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
572 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
573 AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
574 AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
575 AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
576 AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
577 run: |
578 $ErrorActionPreference = "Stop"
579
580 $requiredSecrets = @(
581 $env:AZURE_TENANT_ID,
582 $env:AZURE_CLIENT_ID,
583 $env:AZURE_CLIENT_SECRET,
584 $env:AZURE_TRUSTED_SIGNING_ENDPOINT,
585 $env:AZURE_TRUSTED_SIGNING_ACCOUNT_NAME,
586 $env:AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME,
587 $env:AZURE_TRUSTED_SIGNING_PUBLISHER_NAME
588 )
589 if ($requiredSecrets | Where-Object { [string]::IsNullOrWhiteSpace($_) }) {
590 Write-Host "Azure Trusted Signing disabled; skipping TrustedSigning module preparation."
591 exit 0
592 }
593
594 try {
595 Install-PackageProvider `
596 -Name NuGet `
597 -MinimumVersion 2.8.5.201 `
598 -Force `
599 -Scope CurrentUser `
600 -ErrorAction Stop
601 } catch {
602 Write-Warning "Could not bootstrap NuGet package provider. Continuing because the runner may already have a usable provider. $($_.Exception.Message)"
603 }
604
605 Install-Module `
606 -Name TrustedSigning `
607 -MinimumVersion 0.5.0 `
608 -Force `
609 -AllowClobber `
610 -Repository PSGallery `
611 -Scope CurrentUser `
612 -ErrorAction Stop
613
614 Import-Module TrustedSigning -MinimumVersion 0.5.0 -Force
615 Get-Command Invoke-TrustedSigning -ErrorAction Stop
616
617 $moduleRoots = @(
618 [System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "PowerShell", "Modules"),
619 [System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "WindowsPowerShell", "Modules"),
620 [System.IO.Path]::Combine($env:ProgramFiles, "PowerShell", "Modules"),
621 [System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules")
622 )
623 $modulePathEntries = @($moduleRoots + ($env:PSModulePath -split ";")) |
624 Where-Object { $_ -and (Test-Path $_) } |
625 Select-Object -Unique
626 "PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
627
628 - name: Build desktop artifact
629 shell: bash
630 env:
631 pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
632 T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR: ${{ steps.resource_monitor_cache.outputs.cache-hit == 'true' }}
633 T3CODE_DESKTOP_REUSE_LINUX_CAPTURE_HELPERS: ${{ steps.capture_helper_cache.outputs.cache-hit == 'true' }}
634 CSC_LINK: ${{ secrets.CSC_LINK }}
635 CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
636 APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
637 APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
638 APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
639 APPLE_TEAM_ID: ${{ vars.APPLE_TEAM_ID }}
640 MACOS_PROVISIONING_PROFILE: ${{ secrets.MACOS_PROVISIONING_PROFILE }}
641 T3CODE_CLERK_PASSKEY_RP_DOMAINS: ${{ vars.CLERK_PASSKEY_RP_DOMAINS }}
642 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
643 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
644 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
645 AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
646 AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
647 AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
648 AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
649 run: |
650 args=(
651 --platform "${{ matrix.platform }}"
652 --target "${{ matrix.target }}"
653 --arch "${{ matrix.arch }}"
654 --build-version "${{ needs.preflight.outputs.version }}"
655 --verbose
656 )
657
658 has_all() {
659 for value in "$@"; do
660 if [[ -z "$value" ]]; then
661 return 1
662 fi
663 done
664 return 0
665 }
666
667 if [[ "${{ matrix.platform }}" == "mac" ]]; then
668 if has_all "$CSC_LINK" "$CSC_KEY_PASSWORD" "$APPLE_API_KEY" "$APPLE_API_KEY_ID" "$APPLE_API_ISSUER"; then
669 if ! has_all "$APPLE_TEAM_ID" "$MACOS_PROVISIONING_PROFILE"; then
670 echo "macOS signing is configured, but APPLE_TEAM_ID or MACOS_PROVISIONING_PROFILE is missing." >&2
671 exit 1
672 fi
673
674 key_path="$RUNNER_TEMP/AuthKey_${APPLE_API_KEY_ID}.p8"
675 printf '%s' "$APPLE_API_KEY" > "$key_path"
676 export APPLE_API_KEY="$key_path"
677
678 profile_path="$RUNNER_TEMP/t3code.provisionprofile"
679 printf '%s' "$MACOS_PROVISIONING_PROFILE" | base64 -D > "$profile_path"
680 security cms -D -i "$profile_path" >/dev/null
681 export T3CODE_APPLE_TEAM_ID="$APPLE_TEAM_ID"
682 export T3CODE_MACOS_PROVISIONING_PROFILE="$profile_path"
683
684 echo "macOS signing enabled."
685 args+=(--signed)
686 else
687 echo "macOS signing disabled (missing one or more Apple signing secrets)."
688 fi
689 elif [[ "${{ matrix.platform }}" == "win" ]]; then
690 # Bundle the Linux node-pty binary built by the build_wsl_node_pty job
691 # so the packaged WSL backend ships a ready binary (no first-launch
692 # compile). Required for a working WSL backend on Windows.
693 args+=(--wsl-prebuild "$GITHUB_WORKSPACE/wsl-prebuild/pty.node")
694 if has_all \
695 "$AZURE_TENANT_ID" \
696 "$AZURE_CLIENT_ID" \
697 "$AZURE_CLIENT_SECRET" \
698 "$AZURE_TRUSTED_SIGNING_ENDPOINT" \
699 "$AZURE_TRUSTED_SIGNING_ACCOUNT_NAME" \
700 "$AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME" \
701 "$AZURE_TRUSTED_SIGNING_PUBLISHER_NAME"; then
702 echo "Windows signing enabled (Azure Trusted Signing)."
703 args+=(--signed)
704 else
705 echo "Windows signing disabled (missing one or more Azure Trusted Signing secrets)."
706 fi
707 else
708 echo "Signing disabled for ${{ matrix.platform }}."
709 fi
710
711 vp run dist:desktop:artifact "${args[@]}"
712
713 - name: Collect release assets
714 shell: bash
715 run: |
716 set -euo pipefail
717 mkdir -p release-publish
718
719 shopt -s nullglob
720 for pattern in \
721 "release/*.dmg" \
722 "release/*.zip" \
723 "release/*.AppImage" \
724 "release/*.exe" \
725 "release/*.blockmap" \
726 "release/*.yml"; do
727 for file in $pattern; do
728 cp "$file" release-publish/
729 done
730 done
731
732 if [[ "${{ matrix.platform }}" == "mac" && "${{ matrix.arch }}" != "arm64" ]]; then
733 shopt -s nullglob
734 for manifest in release-publish/*-mac.yml; do
735 mv "$manifest" "${manifest%.yml}-${{ matrix.arch }}.yml"
736 done
737 fi
738
739 # Enable if Windows arm64 builds are enabled.
740 # Windows updater metadata is channel-specific (for example
741 # "latest.yml" or "nightly.yml"). Suffix each per-arch copy so the
742 # release job can merge matching arm64/x64 manifests back into one
743 # canonical manifest per channel.
744 # if [[ "${{ matrix.platform }}" == "win" ]]; then
745 # shopt -s nullglob
746 # for manifest in release-publish/*.yml; do
747 # mv "$manifest" "${manifest%.yml}-win-${{ matrix.arch }}.yml"
748 # done
749 # fi
750
751 - name: Collect resource monitor
752 shell: bash
753 run: |
754 set -euo pipefail
755 binary_name="t3-resource-monitor"
756 if [[ "${{ matrix.platform }}" == "win" ]]; then
757 binary_name="${binary_name}.exe"
758 fi
759 source_path="native/resource-monitor/target/${{ matrix.rust_target }}/release/${binary_name}"
760 target_dir="resource-monitor-publish/${{ matrix.resource_key }}"
761 mkdir -p "$target_dir"
762 cp "$source_path" "$target_dir/$binary_name"
763
764 - name: Upload build artifacts
765 uses: actions/upload-artifact@v7
766 with:
767 name: desktop-${{ matrix.platform }}-${{ matrix.arch }}
768 path: release-publish/*
769 if-no-files-found: error
770
771 - name: Upload resource monitor
772 uses: actions/upload-artifact@v7
773 with:
774 name: resource-monitor-${{ matrix.resource_key }}
775 path: resource-monitor-publish/${{ matrix.resource_key }}/*
776 if-no-files-found: error
777
778 publish_cli:
779 name: Publish CLI to npm
780 needs: [preflight, relay_public_config, quality, build]
781 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.build.result == 'success' }}
782 runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
783 timeout-minutes: 10
784 permissions:
785 contents: read
786 id-token: write
787 env:
788 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
789 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
790 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
791 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
792 steps:
793 - name: Checkout
794 uses: actions/checkout@v6
795 with:
796 ref: ${{ needs.preflight.outputs.ref }}
797 sparse-checkout: |
798 /*
799 !/.repos/
800 sparse-checkout-cone-mode: false
801
802 - name: Setup Vite+
803 uses: voidzero-dev/setup-vp@v1
804 with:
805 node-version-file: package.json
806 cache: true
807 run-install: |
808 args:
809 - --filter=t3...
810 - --filter=@t3tools/web...
811 - --filter=@t3tools/scripts...
812
813 - name: Download relay client tracing config
814 uses: actions/download-artifact@v8
815 with:
816 name: relay-client-tracing-config
817 path: ${{ runner.temp }}/relay-client-tracing
818
819 - name: Load relay client tracing config
820 shell: bash
821 run: |
822 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
823 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
824 echo "::add-mask::$tracing_token"
825 cat "$config_path" >> "$GITHUB_ENV"
826
827 - name: Align package versions to release version
828 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
829
830 # The t3 build task depends on @t3tools/web#build, so the web client is
831 # built (once) as part of this step.
832 - name: Build CLI package
833 run: vp run --filter t3 build
834
835 - name: Download resource monitors
836 uses: actions/download-artifact@v8
837 with:
838 pattern: resource-monitor-*
839 path: ${{ runner.temp }}/resource-monitors
840
841 - name: Bundle resource monitors into CLI package
842 shell: bash
843 run: |
844 set -euo pipefail
845 for artifact_dir in "$RUNNER_TEMP"/resource-monitors/resource-monitor-*; do
846 resource_key="${artifact_dir##*/resource-monitor-}"
847 target_dir="apps/server/dist/resource-monitor/${resource_key}"
848 mkdir -p "$target_dir"
849 cp "$artifact_dir"/t3-resource-monitor* "$target_dir/"
850 chmod +x "$target_dir"/t3-resource-monitor 2>/dev/null || true
851 done
852
853 - name: Publish CLI package
854 run: node apps/server/scripts/cli.ts publish --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --app-version "${{ needs.preflight.outputs.version }}" --verbose
855
856 release:
857 name: Publish GitHub Release
858 needs: [preflight, build, publish_cli]
859 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build.result == 'success' && needs.publish_cli.result == 'success' }}
860 runs-on: blacksmith-8vcpu-ubuntu-2404
861 timeout-minutes: 30
862 permissions:
863 contents: write
864 steps:
865 - name: Checkout
866 uses: actions/checkout@v6
867 with:
868 ref: ${{ needs.preflight.outputs.ref }}
869 sparse-checkout: |
870 /*
871 !/.repos/
872 sparse-checkout-cone-mode: false
873
874 - name: Setup Vite+
875 uses: voidzero-dev/setup-vp@v1
876 with:
877 node-version-file: package.json
878 cache: true
879 run-install: |
880 args:
881 - --filter=@t3tools/scripts...
882
883 - name: Download all desktop artifacts
884 uses: actions/download-artifact@v8
885 with:
886 pattern: desktop-*
887 merge-multiple: true
888 path: release-assets
889
890 - name: Merge macOS updater manifests
891 run: |
892 shopt -s nullglob
893 for x64_manifest in release-assets/*-mac-x64.yml; do
894 arm64_manifest="${x64_manifest%-x64.yml}.yml"
895 if [[ -f "$arm64_manifest" ]]; then
896 node scripts/merge-update-manifests.ts --platform mac "$arm64_manifest" "$x64_manifest"
897 rm -f "$x64_manifest"
898 fi
899 done
900
901 - name: Publish release
902 if: needs.preflight.outputs.previous_tag != ''
903 uses: softprops/action-gh-release@v3
904 with:
905 tag_name: ${{ needs.preflight.outputs.tag }}
906 target_commitish: ${{ needs.preflight.outputs.ref }}
907 name: ${{ needs.preflight.outputs.release_name }}
908 generate_release_notes: true
909 previous_tag: ${{ needs.preflight.outputs.previous_tag }}
910 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
911 make_latest: ${{ needs.preflight.outputs.make_latest }}
912 files: |
913 release-assets/*.dmg
914 release-assets/*.zip
915 release-assets/*.AppImage
916 release-assets/*.exe
917 release-assets/*.blockmap
918 release-assets/*.yml
919 fail_on_unmatched_files: true
920 token: ${{ github.token }}
921
922 - name: Publish first release
923 if: needs.preflight.outputs.previous_tag == ''
924 uses: softprops/action-gh-release@v3
925 with:
926 tag_name: ${{ needs.preflight.outputs.tag }}
927 target_commitish: ${{ needs.preflight.outputs.ref }}
928 name: ${{ needs.preflight.outputs.release_name }}
929 generate_release_notes: true
930 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
931 make_latest: ${{ needs.preflight.outputs.make_latest }}
932 files: |
933 release-assets/*.dmg
934 release-assets/*.zip
935 release-assets/*.AppImage
936 release-assets/*.exe
937 release-assets/*.blockmap
938 release-assets/*.yml
939 fail_on_unmatched_files: true
940 token: ${{ github.token }}
941
942 publish_aur:
943 name: Publish AUR package
944 needs: [preflight, release]
945 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
946 uses: ./.github/workflows/publish-aur.yml
947 with:
948 release_tag: ${{ needs.preflight.outputs.tag }}
949 secrets:
950 AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
951
952 deploy_web:
953 name: Deploy hosted web app
954 needs: [preflight, relay_public_config, release]
955 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.release.result == 'success' }}
956 runs-on: blacksmith-8vcpu-ubuntu-2404
957 timeout-minutes: 10
958 env:
959 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
960 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
961 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
962 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
963 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
964 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
965 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
966 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
967 T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
968 T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
969 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
970 steps:
971 - name: Checkout
972 uses: actions/checkout@v6
973 with:
974 ref: ${{ needs.preflight.outputs.ref }}
975 sparse-checkout: |
976 /*
977 !/.repos/
978 sparse-checkout-cone-mode: false
979
980 - name: Setup Vite+
981 uses: voidzero-dev/setup-vp@v1
982 with:
983 node-version-file: package.json
984 cache: true
985 run-install: |
986 args:
987 - --filter=@t3tools/scripts...
988 - --filter=@t3tools/web...
989
990 - name: Download relay client tracing config
991 uses: actions/download-artifact@v8
992 with:
993 name: relay-client-tracing-config
994 path: ${{ runner.temp }}/relay-client-tracing
995
996 - name: Load relay client tracing config
997 shell: bash
998 run: |
999 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
1000 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
1001 echo "::add-mask::$tracing_token"
1002 cat "$config_path" >> "$GITHUB_ENV"
1003
1004 - name: Align package versions to release version
1005 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
1006
1007 - name: Refresh release lockfile
1008 run: vp install --lockfile-only --ignore-scripts
1009
1010 - name: Deploy and alias channel
1011 shell: bash
1012 run: |
1013 set -euo pipefail
1014
1015 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" || -z "${VERCEL_PROJECT_ID:-}" ]]; then
1016 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID." >&2
1017 exit 1
1018 fi
1019
1020 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
1021 latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
1022 nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
1023 router_domain="${router_url#http://}"
1024 router_domain="${router_domain#https://}"
1025 router_domain="${router_domain%%/*}"
1026
1027 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
1028 channel_domain="$latest_domain"
1029 channel_name="latest"
1030 else
1031 channel_domain="$nightly_domain"
1032 channel_name="nightly"
1033 fi
1034
1035 vercel_scope="${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1036 vercel_scope_args=(--scope "$vercel_scope")
1037
1038 echo "Deploying hosted web app for $channel_name channel."
1039 deployment_url="$(
1040 vp dlx vercel@53.1.1 deploy \
1041 --archive=tgz \
1042 --prod \
1043 --skip-domain \
1044 --yes \
1045 --token "$VERCEL_TOKEN" \
1046 "${vercel_scope_args[@]}" \
1047 --build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
1048 --build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
1049 --build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
1050 --build-env "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID=${T3CODE_CLERK_CLI_OAUTH_CLIENT_ID:-}" \
1051 --build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
1052 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=${T3CODE_RELAY_CLIENT_OTLP_TRACES_URL:-}" \
1053 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=${T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET:-}" \
1054 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=${T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN:-}" \
1055 --build-env "VITE_HOSTED_APP_URL=$router_url" \
1056 --build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
1057 )"
1058
1059 echo "Aliasing $deployment_url to $channel_domain."
1060 vp dlx vercel@53.1.1 alias set "$deployment_url" "$channel_domain" \
1061 --token "$VERCEL_TOKEN" \
1062 "${vercel_scope_args[@]}"
1063
1064 if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
1065 echo "Aliasing $deployment_url to router domain $router_domain."
1066 vp dlx vercel@53.1.1 alias set "$deployment_url" "$router_domain" \
1067 --token "$VERCEL_TOKEN" \
1068 "${vercel_scope_args[@]}"
1069 fi
1070
1071 deploy_marketing:
1072 name: Deploy marketing site
1073 needs: [preflight, release]
1074 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
1075 runs-on: blacksmith-8vcpu-ubuntu-2404
1076 timeout-minutes: 10
1077 env:
1078 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1079 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1080 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1081 steps:
1082 - name: Checkout
1083 uses: actions/checkout@v6
1084 with:
1085 ref: ${{ needs.preflight.outputs.ref }}
1086 sparse-checkout: |
1087 /*
1088 !/.repos/
1089 sparse-checkout-cone-mode: false
1090
1091 - name: Setup Vite+
1092 uses: voidzero-dev/setup-vp@v1
1093 with:
1094 node-version-file: package.json
1095 cache: true
1096 run-install: |
1097 args:
1098 - --filter=@t3tools/marketing...
1099
1100 - name: Deploy marketing site to Vercel
1101 shell: bash
1102 run: |
1103 set -euo pipefail
1104
1105 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" ]]; then
1106 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID." >&2
1107 exit 1
1108 fi
1109
1110 VERCEL_PROJECT_ID="$(
1111 curl --fail --silent --show-error \
1112 --header "Authorization: Bearer $VERCEL_TOKEN" \
1113 "https://api.vercel.com/v9/projects/t3code-marketing?teamId=$VERCEL_ORG_ID" \
1114 | jq --exit-status --raw-output '.id'
1115 )"
1116 export VERCEL_PROJECT_ID
1117
1118 vp dlx vercel@53.1.1 deploy \
1119 --archive=tgz \
1120 --prod \
1121 --yes \
1122 --token "$VERCEL_TOKEN" \
1123 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1124
1125 finalize:
1126 name: Finalize release
1127 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
1128 needs: [preflight, release]
1129 runs-on: blacksmith-8vcpu-ubuntu-2404
1130 timeout-minutes: 10
1131 steps:
1132 - id: app_token
1133 name: Mint release app token
1134 uses: actions/create-github-app-token@v2
1135 with:
1136 app-id: ${{ secrets.RELEASE_APP_ID }}
1137 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
1138 owner: ${{ github.repository_owner }}
1139
1140 - name: Checkout
1141 uses: actions/checkout@v6
1142 with:
1143 ref: main
1144 fetch-depth: 0
1145 token: ${{ steps.app_token.outputs.token }}
1146 persist-credentials: true
1147 sparse-checkout: |
1148 /*
1149 !/.repos/
1150 sparse-checkout-cone-mode: false
1151
1152 - id: app_bot
1153 name: Resolve GitHub App bot identity
1154 env:
1155 GH_TOKEN: ${{ steps.app_token.outputs.token }}
1156 APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
1157 run: |
1158 user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
1159 echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
1160 echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
1161
1162 - name: Setup Vite+
1163 uses: voidzero-dev/setup-vp@v1
1164 with:
1165 node-version-file: package.json
1166 cache: true
1167 run-install: |
1168 args:
1169 - --filter=@t3tools/scripts...
1170 - --filter=@t3tools/oxlint-plugin-t3code...
1171
1172 - id: update_versions
1173 name: Update version strings
1174 env:
1175 RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
1176 run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
1177
1178 - name: Format package.json files
1179 if: steps.update_versions.outputs.changed == 'true'
1180 run: vp fmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
1181
1182 - name: Refresh lockfile
1183 if: steps.update_versions.outputs.changed == 'true'
1184 run: vp install --lockfile-only --ignore-scripts
1185
1186 - name: Commit and push version bump
1187 if: steps.update_versions.outputs.changed == 'true'
1188 shell: bash
1189 env:
1190 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
1191 run: |
1192 if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml; then
1193 echo "No version changes to commit."
1194 exit 0
1195 fi
1196
1197 git config user.name "${{ steps.app_bot.outputs.name }}"
1198 git config user.email "${{ steps.app_bot.outputs.email }}"
1199
1200 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
1201 git commit -m "chore(release): prepare $RELEASE_TAG"
1202 git push origin HEAD:main
1203
1204 announce_discord:
1205 name: Announce release on Discord
1206 if: |
1207 always() && !cancelled() &&
1208 needs.preflight.result == 'success' &&
1209 needs.relay_public_config.result == 'success' &&
1210 needs.release.result == 'success' &&
1211 needs.deploy_web.result == 'success' &&
1212 (needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
1213 needs: [preflight, relay_public_config, release, deploy_web, finalize]
1214 runs-on: blacksmith-8vcpu-ubuntu-2404
1215 timeout-minutes: 10
1216 steps:
1217 - name: Checkout
1218 uses: actions/checkout@v6
1219 with:
1220 ref: ${{ needs.preflight.outputs.ref }}
1221 sparse-checkout: |
1222 /*
1223 !/.repos/
1224 sparse-checkout-cone-mode: false
1225
1226 - name: Setup Vite+
1227 uses: voidzero-dev/setup-vp@v1
1228 with:
1229 node-version-file: package.json
1230 cache: true
1231 run-install: |
1232 args:
1233 - --filter=@t3tools/scripts...
1234
1235 - name: Announce prerelease on Discord
1236 if: needs.preflight.outputs.is_prerelease == 'true'
1237 continue-on-error: true
1238 env:
1239 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_NIGHTLY_ROLE_ID }}
1240 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1241 run: |
1242 node scripts/notify-discord-release.ts prerelease \
1243 --role-id "$DISCORD_MENTION_ROLE_ID" \
1244 --release-name "${{ needs.preflight.outputs.release_name }}" \
1245 --release-version "${{ needs.preflight.outputs.version }}" \
1246 --tag "${{ needs.preflight.outputs.tag }}" \
1247 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"
1248
1249 - name: Announce latest release on Discord
1250 if: needs.preflight.outputs.make_latest == 'true'
1251 continue-on-error: true
1252 env:
1253 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_LATEST_ROLE_ID }}
1254 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1255 run: |
1256 node scripts/notify-discord-release.ts latest \
1257 --role-id "$DISCORD_MENTION_ROLE_ID" \
1258 --release-name "${{ needs.preflight.outputs.release_name }}" \
1259 --release-version "${{ needs.preflight.outputs.version }}" \
1260 --tag "${{ needs.preflight.outputs.tag }}" \
1261 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"