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

release.yml

1,250 lines49.1 KB

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: Setup Rust
491 if: steps.resource_monitor_cache.outputs.cache-hit != 'true'
492 uses: dtolnay/rust-toolchain@stable
493 with:
494 targets: ${{ matrix.rust_target }}
495​
496 - name: Download relay client tracing config
497 uses: actions/download-artifact@v8
498 with:
499 name: relay-client-tracing-config
500 path: ${{ runner.temp }}/relay-client-tracing
501​
502 - name: Load relay client tracing config
503 shell: bash
504 run: |
505 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
506 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
507 echo "::add-mask::$tracing_token"
508 cat "$config_path" >> "$GITHUB_ENV"
509​
510 - name: Align package versions to release version
511 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
512​
513 - name: Download WSL node-pty prebuild
514 if: matrix.platform == 'win'
515 uses: actions/download-artifact@v7
516 with:
517 name: wsl-node-pty-x64
518 path: wsl-prebuild
519​
520 - name: Install Spectre-mitigated MSVC libs
521 if: matrix.platform == 'win'
522 shell: pwsh
523 run: |
524 $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
525 $installPath = & $vswhere -products * -latest -property installationPath
526 $setupExe = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe"
527 $proc = Start-Process -FilePath $setupExe `
528 -ArgumentList "modify", "--installPath", "`"$installPath`"", "--add", `
529 "Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre", "--quiet", "--norestart" `
530 -Wait -PassThru -NoNewWindow
531 if ($null -eq $proc -or $proc.ExitCode -ne 0) {
532 $code = if ($null -ne $proc) { $proc.ExitCode } else { 1 }
533 Write-Error "Visual Studio Installer failed with exit code $code"
534 exit $code
535 }
536​
537 - uses: ./.github/actions/setup-apt-mirrors
538 if: matrix.platform == 'linux'
539​
540 - name: Install Linux desktop build libraries
541 if: matrix.platform == 'linux'
542 shell: bash
543 run: |
544 sudo apt-get update
545 sudo apt-get install -y libsecret-1-dev pkg-config
546 if ! command -v magick >/dev/null 2>&1 && ! command -v convert >/dev/null 2>&1; then
547 sudo apt-get install -y imagemagick
548 fi
549​
550 if command -v magick >/dev/null 2>&1; then
551 magick -version
552 else
553 convert -version
554 fi
555​
556 - name: Prepare Azure Trusted Signing
557 if: matrix.platform == 'win'
558 shell: pwsh
559 env:
560 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
561 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
562 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
563 AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
564 AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
565 AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
566 AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
567 run: |
568 $ErrorActionPreference = "Stop"
569​
570 $requiredSecrets = @(
571 $env:AZURE_TENANT_ID,
572 $env:AZURE_CLIENT_ID,
573 $env:AZURE_CLIENT_SECRET,
574 $env:AZURE_TRUSTED_SIGNING_ENDPOINT,
575 $env:AZURE_TRUSTED_SIGNING_ACCOUNT_NAME,
576 $env:AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME,
577 $env:AZURE_TRUSTED_SIGNING_PUBLISHER_NAME
578 )
579 if ($requiredSecrets | Where-Object { [string]::IsNullOrWhiteSpace($_) }) {
580 Write-Host "Azure Trusted Signing disabled; skipping TrustedSigning module preparation."
581 exit 0
582 }
583​
584 try {
585 Install-PackageProvider `
586 -Name NuGet `
587 -MinimumVersion 2.8.5.201 `
588 -Force `
589 -Scope CurrentUser `
590 -ErrorAction Stop
591 } catch {
592 Write-Warning "Could not bootstrap NuGet package provider. Continuing because the runner may already have a usable provider. $($_.Exception.Message)"
593 }
594​
595 Install-Module `
596 -Name TrustedSigning `
597 -MinimumVersion 0.5.0 `
598 -Force `
599 -AllowClobber `
600 -Repository PSGallery `
601 -Scope CurrentUser `
602 -ErrorAction Stop
603​
604 Import-Module TrustedSigning -MinimumVersion 0.5.0 -Force
605 Get-Command Invoke-TrustedSigning -ErrorAction Stop
606​
607 $moduleRoots = @(
608 [System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "PowerShell", "Modules"),
609 [System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "WindowsPowerShell", "Modules"),
610 [System.IO.Path]::Combine($env:ProgramFiles, "PowerShell", "Modules"),
611 [System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules")
612 )
613 $modulePathEntries = @($moduleRoots + ($env:PSModulePath -split ";")) |
614 Where-Object { $_ -and (Test-Path $_) } |
615 Select-Object -Unique
616 "PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
617​
618 - name: Build desktop artifact
619 shell: bash
620 env:
621 pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
622 T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR: ${{ steps.resource_monitor_cache.outputs.cache-hit == 'true' }}
623 CSC_LINK: ${{ secrets.CSC_LINK }}
624 CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
625 APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
626 APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
627 APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
628 APPLE_TEAM_ID: ${{ vars.APPLE_TEAM_ID }}
629 MACOS_PROVISIONING_PROFILE: ${{ secrets.MACOS_PROVISIONING_PROFILE }}
630 T3CODE_CLERK_PASSKEY_RP_DOMAINS: ${{ vars.CLERK_PASSKEY_RP_DOMAINS }}
631 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
632 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
633 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
634 AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
635 AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
636 AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
637 AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
638 run: |
639 args=(
640 --platform "${{ matrix.platform }}"
641 --target "${{ matrix.target }}"
642 --arch "${{ matrix.arch }}"
643 --build-version "${{ needs.preflight.outputs.version }}"
644 --verbose
645 )
646​
647 has_all() {
648 for value in "$@"; do
649 if [[ -z "$value" ]]; then
650 return 1
651 fi
652 done
653 return 0
654 }
655​
656 if [[ "${{ matrix.platform }}" == "mac" ]]; then
657 if has_all "$CSC_LINK" "$CSC_KEY_PASSWORD" "$APPLE_API_KEY" "$APPLE_API_KEY_ID" "$APPLE_API_ISSUER"; then
658 if ! has_all "$APPLE_TEAM_ID" "$MACOS_PROVISIONING_PROFILE"; then
659 echo "macOS signing is configured, but APPLE_TEAM_ID or MACOS_PROVISIONING_PROFILE is missing." >&2
660 exit 1
661 fi
662​
663 key_path="$RUNNER_TEMP/AuthKey_${APPLE_API_KEY_ID}.p8"
664 printf '%s' "$APPLE_API_KEY" > "$key_path"
665 export APPLE_API_KEY="$key_path"
666​
667 profile_path="$RUNNER_TEMP/t3code.provisionprofile"
668 printf '%s' "$MACOS_PROVISIONING_PROFILE" | base64 -D > "$profile_path"
669 security cms -D -i "$profile_path" >/dev/null
670 export T3CODE_APPLE_TEAM_ID="$APPLE_TEAM_ID"
671 export T3CODE_MACOS_PROVISIONING_PROFILE="$profile_path"
672​
673 echo "macOS signing enabled."
674 args+=(--signed)
675 else
676 echo "macOS signing disabled (missing one or more Apple signing secrets)."
677 fi
678 elif [[ "${{ matrix.platform }}" == "win" ]]; then
679 # Bundle the Linux node-pty binary built by the build_wsl_node_pty job
680 # so the packaged WSL backend ships a ready binary (no first-launch
681 # compile). Required for a working WSL backend on Windows.
682 args+=(--wsl-prebuild "$GITHUB_WORKSPACE/wsl-prebuild/pty.node")
683 if has_all \
684 "$AZURE_TENANT_ID" \
685 "$AZURE_CLIENT_ID" \
686 "$AZURE_CLIENT_SECRET" \
687 "$AZURE_TRUSTED_SIGNING_ENDPOINT" \
688 "$AZURE_TRUSTED_SIGNING_ACCOUNT_NAME" \
689 "$AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME" \
690 "$AZURE_TRUSTED_SIGNING_PUBLISHER_NAME"; then
691 echo "Windows signing enabled (Azure Trusted Signing)."
692 args+=(--signed)
693 else
694 echo "Windows signing disabled (missing one or more Azure Trusted Signing secrets)."
695 fi
696 else
697 echo "Signing disabled for ${{ matrix.platform }}."
698 fi
699​
700 vp run dist:desktop:artifact "${args[@]}"
701​
702 - name: Collect release assets
703 shell: bash
704 run: |
705 set -euo pipefail
706 mkdir -p release-publish
707​
708 shopt -s nullglob
709 for pattern in \
710 "release/*.dmg" \
711 "release/*.zip" \
712 "release/*.AppImage" \
713 "release/*.exe" \
714 "release/*.blockmap" \
715 "release/*.yml"; do
716 for file in $pattern; do
717 cp "$file" release-publish/
718 done
719 done
720​
721 if [[ "${{ matrix.platform }}" == "mac" && "${{ matrix.arch }}" != "arm64" ]]; then
722 shopt -s nullglob
723 for manifest in release-publish/*-mac.yml; do
724 mv "$manifest" "${manifest%.yml}-${{ matrix.arch }}.yml"
725 done
726 fi
727​
728 # Enable if Windows arm64 builds are enabled.
729 # Windows updater metadata is channel-specific (for example
730 # "latest.yml" or "nightly.yml"). Suffix each per-arch copy so the
731 # release job can merge matching arm64/x64 manifests back into one
732 # canonical manifest per channel.
733 # if [[ "${{ matrix.platform }}" == "win" ]]; then
734 # shopt -s nullglob
735 # for manifest in release-publish/*.yml; do
736 # mv "$manifest" "${manifest%.yml}-win-${{ matrix.arch }}.yml"
737 # done
738 # fi
739​
740 - name: Collect resource monitor
741 shell: bash
742 run: |
743 set -euo pipefail
744 binary_name="t3-resource-monitor"
745 if [[ "${{ matrix.platform }}" == "win" ]]; then
746 binary_name="${binary_name}.exe"
747 fi
748 source_path="native/resource-monitor/target/${{ matrix.rust_target }}/release/${binary_name}"
749 target_dir="resource-monitor-publish/${{ matrix.resource_key }}"
750 mkdir -p "$target_dir"
751 cp "$source_path" "$target_dir/$binary_name"
752​
753 - name: Upload build artifacts
754 uses: actions/upload-artifact@v7
755 with:
756 name: desktop-${{ matrix.platform }}-${{ matrix.arch }}
757 path: release-publish/*
758 if-no-files-found: error
759​
760 - name: Upload resource monitor
761 uses: actions/upload-artifact@v7
762 with:
763 name: resource-monitor-${{ matrix.resource_key }}
764 path: resource-monitor-publish/${{ matrix.resource_key }}/*
765 if-no-files-found: error
766​
767 publish_cli:
768 name: Publish CLI to npm
769 needs: [preflight, relay_public_config, quality, build]
770 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.build.result == 'success' }}
771 runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
772 timeout-minutes: 10
773 permissions:
774 contents: read
775 id-token: write
776 env:
777 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
778 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
779 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
780 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
781 steps:
782 - name: Checkout
783 uses: actions/checkout@v6
784 with:
785 ref: ${{ needs.preflight.outputs.ref }}
786 sparse-checkout: |
787 /*
788 !/.repos/
789 sparse-checkout-cone-mode: false
790​
791 - name: Setup Vite+
792 uses: voidzero-dev/setup-vp@v1
793 with:
794 node-version-file: package.json
795 cache: true
796 run-install: |
797 args:
798 - --filter=t3...
799 - --filter=@t3tools/web...
800 - --filter=@t3tools/scripts...
801​
802 - name: Download relay client tracing config
803 uses: actions/download-artifact@v8
804 with:
805 name: relay-client-tracing-config
806 path: ${{ runner.temp }}/relay-client-tracing
807​
808 - name: Load relay client tracing config
809 shell: bash
810 run: |
811 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
812 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
813 echo "::add-mask::$tracing_token"
814 cat "$config_path" >> "$GITHUB_ENV"
815​
816 - name: Align package versions to release version
817 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
818​
819 # The t3 build task depends on @t3tools/web#build, so the web client is
820 # built (once) as part of this step.
821 - name: Build CLI package
822 run: vp run --filter t3 build
823​
824 - name: Download resource monitors
825 uses: actions/download-artifact@v8
826 with:
827 pattern: resource-monitor-*
828 path: ${{ runner.temp }}/resource-monitors
829​
830 - name: Bundle resource monitors into CLI package
831 shell: bash
832 run: |
833 set -euo pipefail
834 for artifact_dir in "$RUNNER_TEMP"/resource-monitors/resource-monitor-*; do
835 resource_key="${artifact_dir##*/resource-monitor-}"
836 target_dir="apps/server/dist/resource-monitor/${resource_key}"
837 mkdir -p "$target_dir"
838 cp "$artifact_dir"/t3-resource-monitor* "$target_dir/"
839 chmod +x "$target_dir"/t3-resource-monitor 2>/dev/null || true
840 done
841​
842 - name: Publish CLI package
843 run: node apps/server/scripts/cli.ts publish --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --app-version "${{ needs.preflight.outputs.version }}" --verbose
844​
845 release:
846 name: Publish GitHub Release
847 needs: [preflight, build, publish_cli]
848 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build.result == 'success' && needs.publish_cli.result == 'success' }}
849 runs-on: blacksmith-8vcpu-ubuntu-2404
850 timeout-minutes: 30
851 permissions:
852 contents: write
853 steps:
854 - name: Checkout
855 uses: actions/checkout@v6
856 with:
857 ref: ${{ needs.preflight.outputs.ref }}
858 sparse-checkout: |
859 /*
860 !/.repos/
861 sparse-checkout-cone-mode: false
862​
863 - name: Setup Vite+
864 uses: voidzero-dev/setup-vp@v1
865 with:
866 node-version-file: package.json
867 cache: true
868 run-install: |
869 args:
870 - --filter=@t3tools/scripts...
871​
872 - name: Download all desktop artifacts
873 uses: actions/download-artifact@v8
874 with:
875 pattern: desktop-*
876 merge-multiple: true
877 path: release-assets
878​
879 - name: Merge macOS updater manifests
880 run: |
881 shopt -s nullglob
882 for x64_manifest in release-assets/*-mac-x64.yml; do
883 arm64_manifest="${x64_manifest%-x64.yml}.yml"
884 if [[ -f "$arm64_manifest" ]]; then
885 node scripts/merge-update-manifests.ts --platform mac "$arm64_manifest" "$x64_manifest"
886 rm -f "$x64_manifest"
887 fi
888 done
889​
890 - name: Publish release
891 if: needs.preflight.outputs.previous_tag != ''
892 uses: softprops/action-gh-release@v3
893 with:
894 tag_name: ${{ needs.preflight.outputs.tag }}
895 target_commitish: ${{ needs.preflight.outputs.ref }}
896 name: ${{ needs.preflight.outputs.release_name }}
897 generate_release_notes: true
898 previous_tag: ${{ needs.preflight.outputs.previous_tag }}
899 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
900 make_latest: ${{ needs.preflight.outputs.make_latest }}
901 files: |
902 release-assets/*.dmg
903 release-assets/*.zip
904 release-assets/*.AppImage
905 release-assets/*.exe
906 release-assets/*.blockmap
907 release-assets/*.yml
908 fail_on_unmatched_files: true
909 token: ${{ github.token }}
910​
911 - name: Publish first release
912 if: needs.preflight.outputs.previous_tag == ''
913 uses: softprops/action-gh-release@v3
914 with:
915 tag_name: ${{ needs.preflight.outputs.tag }}
916 target_commitish: ${{ needs.preflight.outputs.ref }}
917 name: ${{ needs.preflight.outputs.release_name }}
918 generate_release_notes: true
919 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
920 make_latest: ${{ needs.preflight.outputs.make_latest }}
921 files: |
922 release-assets/*.dmg
923 release-assets/*.zip
924 release-assets/*.AppImage
925 release-assets/*.exe
926 release-assets/*.blockmap
927 release-assets/*.yml
928 fail_on_unmatched_files: true
929 token: ${{ github.token }}
930​
931 publish_aur:
932 name: Publish AUR package
933 needs: [preflight, release]
934 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
935 uses: ./.github/workflows/publish-aur.yml
936 with:
937 release_tag: ${{ needs.preflight.outputs.tag }}
938 secrets:
939 AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
940​
941 deploy_web:
942 name: Deploy hosted web app
943 needs: [preflight, relay_public_config, release]
944 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.release.result == 'success' }}
945 runs-on: blacksmith-8vcpu-ubuntu-2404
946 timeout-minutes: 10
947 env:
948 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
949 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
950 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
951 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
952 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
953 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
954 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
955 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
956 T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
957 T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
958 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
959 steps:
960 - name: Checkout
961 uses: actions/checkout@v6
962 with:
963 ref: ${{ needs.preflight.outputs.ref }}
964 sparse-checkout: |
965 /*
966 !/.repos/
967 sparse-checkout-cone-mode: false
968​
969 - name: Setup Vite+
970 uses: voidzero-dev/setup-vp@v1
971 with:
972 node-version-file: package.json
973 cache: true
974 run-install: |
975 args:
976 - --filter=@t3tools/scripts...
977 - --filter=@t3tools/web...
978​
979 - name: Download relay client tracing config
980 uses: actions/download-artifact@v8
981 with:
982 name: relay-client-tracing-config
983 path: ${{ runner.temp }}/relay-client-tracing
984​
985 - name: Load relay client tracing config
986 shell: bash
987 run: |
988 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
989 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
990 echo "::add-mask::$tracing_token"
991 cat "$config_path" >> "$GITHUB_ENV"
992​
993 - name: Align package versions to release version
994 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
995​
996 - name: Refresh release lockfile
997 run: vp install --lockfile-only --ignore-scripts
998​
999 - name: Deploy and alias channel
1000 shell: bash
1001 run: |
1002 set -euo pipefail
1003​
1004 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" || -z "${VERCEL_PROJECT_ID:-}" ]]; then
1005 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID." >&2
1006 exit 1
1007 fi
1008​
1009 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
1010 latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
1011 nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
1012 router_domain="${router_url#http://}"
1013 router_domain="${router_domain#https://}"
1014 router_domain="${router_domain%%/*}"
1015​
1016 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
1017 channel_domain="$latest_domain"
1018 channel_name="latest"
1019 else
1020 channel_domain="$nightly_domain"
1021 channel_name="nightly"
1022 fi
1023​
1024 vercel_scope="${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1025 vercel_scope_args=(--scope "$vercel_scope")
1026​
1027 echo "Deploying hosted web app for $channel_name channel."
1028 deployment_url="$(
1029 vp dlx vercel@53.1.1 deploy \
1030 --archive=tgz \
1031 --prod \
1032 --skip-domain \
1033 --yes \
1034 --token "$VERCEL_TOKEN" \
1035 "${vercel_scope_args[@]}" \
1036 --build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
1037 --build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
1038 --build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
1039 --build-env "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID=${T3CODE_CLERK_CLI_OAUTH_CLIENT_ID:-}" \
1040 --build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
1041 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=${T3CODE_RELAY_CLIENT_OTLP_TRACES_URL:-}" \
1042 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=${T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET:-}" \
1043 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=${T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN:-}" \
1044 --build-env "VITE_HOSTED_APP_URL=$router_url" \
1045 --build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
1046 )"
1047​
1048 echo "Aliasing $deployment_url to $channel_domain."
1049 vp dlx vercel@53.1.1 alias set "$deployment_url" "$channel_domain" \
1050 --token "$VERCEL_TOKEN" \
1051 "${vercel_scope_args[@]}"
1052​
1053 if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
1054 echo "Aliasing $deployment_url to router domain $router_domain."
1055 vp dlx vercel@53.1.1 alias set "$deployment_url" "$router_domain" \
1056 --token "$VERCEL_TOKEN" \
1057 "${vercel_scope_args[@]}"
1058 fi
1059​
1060 deploy_marketing:
1061 name: Deploy marketing site
1062 needs: [preflight, release]
1063 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
1064 runs-on: blacksmith-8vcpu-ubuntu-2404
1065 timeout-minutes: 10
1066 env:
1067 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1068 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1069 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1070 steps:
1071 - name: Checkout
1072 uses: actions/checkout@v6
1073 with:
1074 ref: ${{ needs.preflight.outputs.ref }}
1075 sparse-checkout: |
1076 /*
1077 !/.repos/
1078 sparse-checkout-cone-mode: false
1079​
1080 - name: Setup Vite+
1081 uses: voidzero-dev/setup-vp@v1
1082 with:
1083 node-version-file: package.json
1084 cache: true
1085 run-install: |
1086 args:
1087 - --filter=@t3tools/marketing...
1088​
1089 - name: Deploy marketing site to Vercel
1090 shell: bash
1091 run: |
1092 set -euo pipefail
1093​
1094 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" ]]; then
1095 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID." >&2
1096 exit 1
1097 fi
1098​
1099 VERCEL_PROJECT_ID="$(
1100 curl --fail --silent --show-error \
1101 --header "Authorization: Bearer $VERCEL_TOKEN" \
1102 "https://api.vercel.com/v9/projects/t3code-marketing?teamId=$VERCEL_ORG_ID" \
1103 | jq --exit-status --raw-output '.id'
1104 )"
1105 export VERCEL_PROJECT_ID
1106​
1107 vp dlx vercel@53.1.1 deploy \
1108 --archive=tgz \
1109 --prod \
1110 --yes \
1111 --token "$VERCEL_TOKEN" \
1112 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1113​
1114 finalize:
1115 name: Finalize release
1116 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
1117 needs: [preflight, release]
1118 runs-on: blacksmith-8vcpu-ubuntu-2404
1119 timeout-minutes: 10
1120 steps:
1121 - id: app_token
1122 name: Mint release app token
1123 uses: actions/create-github-app-token@v2
1124 with:
1125 app-id: ${{ secrets.RELEASE_APP_ID }}
1126 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
1127 owner: ${{ github.repository_owner }}
1128​
1129 - name: Checkout
1130 uses: actions/checkout@v6
1131 with:
1132 ref: main
1133 fetch-depth: 0
1134 token: ${{ steps.app_token.outputs.token }}
1135 persist-credentials: true
1136 sparse-checkout: |
1137 /*
1138 !/.repos/
1139 sparse-checkout-cone-mode: false
1140​
1141 - id: app_bot
1142 name: Resolve GitHub App bot identity
1143 env:
1144 GH_TOKEN: ${{ steps.app_token.outputs.token }}
1145 APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
1146 run: |
1147 user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
1148 echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
1149 echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
1150​
1151 - name: Setup Vite+
1152 uses: voidzero-dev/setup-vp@v1
1153 with:
1154 node-version-file: package.json
1155 cache: true
1156 run-install: |
1157 args:
1158 - --filter=@t3tools/scripts...
1159 - --filter=@t3tools/oxlint-plugin-t3code...
1160​
1161 - id: update_versions
1162 name: Update version strings
1163 env:
1164 RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
1165 run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
1166​
1167 - name: Format package.json files
1168 if: steps.update_versions.outputs.changed == 'true'
1169 run: vp fmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
1170​
1171 - name: Refresh lockfile
1172 if: steps.update_versions.outputs.changed == 'true'
1173 run: vp install --lockfile-only --ignore-scripts
1174​
1175 - name: Commit and push version bump
1176 if: steps.update_versions.outputs.changed == 'true'
1177 shell: bash
1178 env:
1179 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
1180 run: |
1181 if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml; then
1182 echo "No version changes to commit."
1183 exit 0
1184 fi
1185​
1186 git config user.name "${{ steps.app_bot.outputs.name }}"
1187 git config user.email "${{ steps.app_bot.outputs.email }}"
1188​
1189 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
1190 git commit -m "chore(release): prepare $RELEASE_TAG"
1191 git push origin HEAD:main
1192​
1193 announce_discord:
1194 name: Announce release on Discord
1195 if: |
1196 always() && !cancelled() &&
1197 needs.preflight.result == 'success' &&
1198 needs.relay_public_config.result == 'success' &&
1199 needs.release.result == 'success' &&
1200 needs.deploy_web.result == 'success' &&
1201 (needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
1202 needs: [preflight, relay_public_config, release, deploy_web, finalize]
1203 runs-on: blacksmith-8vcpu-ubuntu-2404
1204 timeout-minutes: 10
1205 steps:
1206 - name: Checkout
1207 uses: actions/checkout@v6
1208 with:
1209 ref: ${{ needs.preflight.outputs.ref }}
1210 sparse-checkout: |
1211 /*
1212 !/.repos/
1213 sparse-checkout-cone-mode: false
1214​
1215 - name: Setup Vite+
1216 uses: voidzero-dev/setup-vp@v1
1217 with:
1218 node-version-file: package.json
1219 cache: true
1220 run-install: |
1221 args:
1222 - --filter=@t3tools/scripts...
1223​
1224 - name: Announce prerelease on Discord
1225 if: needs.preflight.outputs.is_prerelease == 'true'
1226 continue-on-error: true
1227 env:
1228 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_NIGHTLY_ROLE_ID }}
1229 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1230 run: |
1231 node scripts/notify-discord-release.ts prerelease \
1232 --role-id "$DISCORD_MENTION_ROLE_ID" \
1233 --release-name "${{ needs.preflight.outputs.release_name }}" \
1234 --release-version "${{ needs.preflight.outputs.version }}" \
1235 --tag "${{ needs.preflight.outputs.tag }}" \
1236 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"
1237​
1238 - name: Announce latest release on Discord
1239 if: needs.preflight.outputs.make_latest == 'true'
1240 continue-on-error: true
1241 env:
1242 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_LATEST_ROLE_ID }}
1243 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1244 run: |
1245 node scripts/notify-discord-release.ts latest \
1246 --role-id "$DISCORD_MENTION_ROLE_ID" \
1247 --release-name "${{ needs.preflight.outputs.release_name }}" \
1248 --release-version "${{ needs.preflight.outputs.version }}" \
1249 --tag "${{ needs.preflight.outputs.tag }}" \
1250 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"