Open History to see the last commit
1name: Release
2
3on:
4 push:
5 tags:
6 - "v*.*.*"
7 - "!v*-nightly.*"
8 - "!v*-preview.*"
9 schedule:
10 # Avoid minute zero, when GitHub scheduled jobs are busiest.
11 - cron: "8,38 * * * *"
12 workflow_dispatch:
13 inputs:
14 channel:
15 description: "Release channel"
16 required: false
17 default: preview
18 type: choice
19 options:
20 - preview
21 - stable
22 - nightly
23 version:
24 description: "Stable version override (for example 1.2.3). Defaults to the version the latest nightly previewed."
25 required: false
26 type: string
27
28# Serialize nightlies (scheduled and manual) so overlapping runs cannot build
29# the same commit twice or publish out of order. Stable tag releases get their
30# own group so a nightly never blocks them. Running publishers are never
31# canceled, and queue: max keeps every pending run instead of the default
32# newest-wins single slot, so a queued stable tag can never be silently
33# dropped. Automatic nightlies recheck the release gap after leaving the queue.
34concurrency:
35 group: release-${{ (github.event_name == 'schedule' || inputs.channel == 'nightly' || inputs.channel == 'preview') && 'nightly' || 'stable' }}
36 cancel-in-progress: false
37 queue: max
38
39permissions:
40 # The Windows desktop jobs read this run's artifact list to wait for the
41 # Linux CLI archive they embed (see release-desktop.yml).
42 actions: read
43 contents: read
44 id-token: none
45
46jobs:
47 # Picks the commit every later job builds. Nightlies and tag pushes build the
48 # triggering commit. Manual stable releases build the commit of the latest
49 # published nightly, so stable only ever ships a build that nightly users
50 # have already run. Scheduled runs also decide here whether a nightly is due.
51 resolve_commit:
52 name: Resolve release commit
53 if: github.repository == 'pingdotgg/t3code'
54 runs-on: blacksmith-8vcpu-ubuntu-2404
55 timeout-minutes: 5
56 outputs:
57 ref: ${{ steps.resolve.outputs.ref }}
58 nightly_version: ${{ steps.resolve.outputs.nightly_version }}
59 has_changes: ${{ steps.resolve.outputs.has_changes }}
60 steps:
61 - name: Checkout
62 uses: actions/checkout@v6
63 with:
64 sparse-checkout: .github/scripts
65
66 - id: resolve
67 name: Resolve release commit
68 uses: actions/github-script@v8
69 env:
70 DISPATCH_CHANNEL: ${{ inputs.channel }}
71 with:
72 script: |
73 const {
74 assertCommitOnDefaultBranch,
75 assertReleaseSource,
76 shouldReleaseNightly,
77 resolveLatestNightlyCommit,
78 } = require('./.github/scripts/check-nightly-release.cjs');
79
80 const dispatchChannel = process.env.DISPATCH_CHANNEL || 'preview';
81 const releaseChannel = context.eventName === 'schedule'
82 ? 'nightly'
83 : context.eventName === 'workflow_dispatch'
84 ? dispatchChannel
85 : 'stable';
86
87 await assertReleaseSource({ github, context, releaseChannel });
88
89 if (context.eventName === 'schedule') {
90 core.setOutput('has_changes', await shouldReleaseNightly({ github, context, core }));
91 core.setOutput('ref', context.sha);
92 } else if (context.eventName === 'workflow_dispatch' && dispatchChannel === 'stable') {
93 const { tag, sha, version } = await resolveLatestNightlyCommit({ github, context, core });
94 await assertCommitOnDefaultBranch({ github, context, sha });
95 core.notice(`Stable release builds ${sha}, the commit shipped by ${tag}.`);
96 core.setOutput('ref', sha);
97 core.setOutput('nightly_version', version);
98 } else {
99 core.setOutput('ref', context.sha);
100 }
101
102 preflight:
103 name: Preflight
104 needs: [resolve_commit]
105 if: |
106 needs.resolve_commit.result == 'success' &&
107 (github.event_name != 'schedule' || needs.resolve_commit.outputs.has_changes == 'true')
108 runs-on: blacksmith-8vcpu-ubuntu-2404
109 timeout-minutes: 10
110 outputs:
111 release_channel: ${{ steps.release_meta.outputs.release_channel }}
112 version: ${{ steps.release_meta.outputs.version }}
113 tag: ${{ steps.release_meta.outputs.tag }}
114 release_name: ${{ steps.release_meta.outputs.name }}
115 short_sha: ${{ steps.release_meta.outputs.short_sha }}
116 previous_tag: ${{ steps.previous_tag.outputs.previous_tag }}
117 cli_dist_tag: ${{ steps.release_meta.outputs.cli_dist_tag }}
118 is_prerelease: ${{ steps.release_meta.outputs.is_prerelease }}
119 make_latest: ${{ steps.release_meta.outputs.make_latest }}
120 ref: ${{ needs.resolve_commit.outputs.ref }}
121 steps:
122 - name: Checkout
123 uses: actions/checkout@v6
124 with:
125 ref: ${{ needs.resolve_commit.outputs.ref }}
126 fetch-depth: 0
127 sparse-checkout: |
128 /*
129 !/.repos/
130 sparse-checkout-cone-mode: false
131
132 - name: Setup dependencies
133 uses: ./.github/actions/setup-ci-deps
134 env:
135 pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
136
137 - id: release_meta
138 name: Resolve release version
139 shell: bash
140 env:
141 DISPATCH_CHANNEL: ${{ github.event.inputs.channel }}
142 DISPATCH_VERSION: ${{ github.event.inputs.version }}
143 NIGHTLY_VERSION: ${{ needs.resolve_commit.outputs.nightly_version }}
144 NIGHTLY_DATE: ${{ github.run_started_at }}
145 NIGHTLY_SHA: ${{ needs.resolve_commit.outputs.ref }}
146 NIGHTLY_RUN_NUMBER: ${{ github.run_number }}
147 run: |
148 if [[ "${GITHUB_EVENT_NAME}" == "schedule" || ( "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-preview}" == "nightly" ) ]]; then
149 nightly_date="$(date -u -d "$NIGHTLY_DATE" +%Y%m%d)"
150
151 node scripts/resolve-nightly-release.ts \
152 --date "$nightly_date" \
153 --run-number "$NIGHTLY_RUN_NUMBER" \
154 --sha "$NIGHTLY_SHA" \
155 --github-output
156
157 echo "release_channel=nightly" >> "$GITHUB_OUTPUT"
158 echo "cli_dist_tag=nightly" >> "$GITHUB_OUTPUT"
159 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
160 echo "make_latest=false" >> "$GITHUB_OUTPUT"
161 elif [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-preview}" == "preview" ]]; then
162 # Manual-only test train: exercises the whole release flow for a
163 # commit end users must never receive. Never scheduled.
164 # Same versioning as nightly under its own prerelease identifier.
165 # A preview release is reachable only by asking for it: npm gets it
166 # under the `preview` dist-tag, which nothing resolves by default,
167 # its desktop builds carry no update feed, and no updater manifest
168 # is attached to the release, so neither stable nor nightly
169 # installs can ever be offered one.
170 nightly_date="$(date -u -d "$NIGHTLY_DATE" +%Y%m%d)"
171
172 node scripts/resolve-nightly-release.ts \
173 --channel preview \
174 --date "$nightly_date" \
175 --run-number "$NIGHTLY_RUN_NUMBER" \
176 --sha "$NIGHTLY_SHA" \
177 --github-output
178
179 echo "release_channel=preview" >> "$GITHUB_OUTPUT"
180 echo "cli_dist_tag=preview" >> "$GITHUB_OUTPUT"
181 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
182 echo "make_latest=false" >> "$GITHUB_OUTPUT"
183 else
184 if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
185 raw="${DISPATCH_VERSION:-$NIGHTLY_VERSION}"
186 if [[ -z "$raw" ]]; then
187 echo "workflow_dispatch stable releases need a version input or a published nightly." >&2
188 exit 1
189 fi
190 else
191 raw="${GITHUB_REF_NAME}"
192 fi
193
194 version="${raw#v}"
195 if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
196 echo "Invalid release version: $raw" >&2
197 exit 1
198 fi
199
200 echo "release_channel=stable" >> "$GITHUB_OUTPUT"
201 echo "version=$version" >> "$GITHUB_OUTPUT"
202 echo "tag=v$version" >> "$GITHUB_OUTPUT"
203 echo "name=T3 Code v$version" >> "$GITHUB_OUTPUT"
204 echo "cli_dist_tag=latest" >> "$GITHUB_OUTPUT"
205 if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
206 echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
207 echo "make_latest=true" >> "$GITHUB_OUTPUT"
208 else
209 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
210 echo "make_latest=false" >> "$GITHUB_OUTPUT"
211 fi
212 fi
213
214 - id: previous_tag
215 name: Resolve previous release tag
216 run: |
217 node scripts/resolve-previous-release-tag.ts \
218 --channel "${{ steps.release_meta.outputs.release_channel }}" \
219 --current-tag "${{ steps.release_meta.outputs.tag }}" \
220 --github-output
221
222 # Share only the verification results, not the large registry metadata cache.
223 - name: Upload dependency verification
224 continue-on-error: true
225 uses: actions/upload-artifact@v7
226 with:
227 name: release-dependency-verification
228 path: ${{ runner.temp }}/pnpm-metadata/lockfile-verified.jsonl
229
230 quality:
231 name: Release quality checks
232 needs: [preflight]
233 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
234 runs-on: blacksmith-8vcpu-ubuntu-2404
235 timeout-minutes: 10
236 steps:
237 - name: Checkout
238 uses: actions/checkout@v6
239 with:
240 ref: ${{ needs.preflight.outputs.ref }}
241 sparse-checkout: |
242 /*
243 !/.repos/
244 sparse-checkout-cone-mode: false
245
246 - name: Setup dependencies
247 uses: ./.github/actions/setup-ci-deps
248
249 - name: Ensure Electron runtime is installed
250 run: vp run --filter @t3tools/desktop ensure:electron
251
252 - name: Check
253 run: vp check
254
255 - name: Typecheck
256 run: vp run typecheck
257
258 # Keep tests on their own runners, using the same package split and server
259 # shards as CI (test, test_web, test_server in ci.yml). Keep the two in sync.
260 test:
261 name: Release tests
262 needs: [preflight]
263 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
264 runs-on: blacksmith-8vcpu-ubuntu-2404
265 timeout-minutes: 10
266 steps:
267 - name: Checkout
268 uses: actions/checkout@v6
269 with:
270 ref: ${{ needs.preflight.outputs.ref }}
271 sparse-checkout: |
272 /*
273 !/.repos/
274 sparse-checkout-cone-mode: false
275
276 - name: Setup dependencies
277 uses: ./.github/actions/setup-ci-deps
278
279 - name: Ensure Electron runtime is installed
280 run: vp run --filter @t3tools/desktop ensure:electron
281
282 - uses: ./.github/actions/setup-apt-mirrors
283
284 - name: Install browser secret helper build libraries
285 run: |
286 sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
287 sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config build-essential
288
289 - name: Test
290 run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' --filter '!@t3tools/web' test
291
292 # Web browser tests time out when they share a runner with the other package
293 # suites: Chromium gets too little CPU and diff workers miss their 10s start budget.
294 test_web:
295 name: Release web tests
296 needs: [preflight]
297 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
298 runs-on: blacksmith-8vcpu-ubuntu-2404
299 timeout-minutes: 10
300 steps:
301 - name: Checkout
302 uses: actions/checkout@v6
303 with:
304 ref: ${{ needs.preflight.outputs.ref }}
305 sparse-checkout: |
306 /*
307 !/.repos/
308 sparse-checkout-cone-mode: false
309
310 - name: Setup dependencies
311 uses: ./.github/actions/setup-ci-deps
312
313 - name: Resolve Playwright version
314 id: playwright_version
315 run: echo "version=$(node -p "require('./apps/web/node_modules/playwright/package.json').version")" >> "$GITHUB_OUTPUT"
316
317 - name: Cache Chromium
318 id: chromium_cache
319 uses: actions/cache@v6
320 with:
321 path: ~/.cache/ms-playwright
322 key: playwright-chromium-shell-${{ runner.os }}-${{ runner.arch }}-${{ steps.playwright_version.outputs.version }}
323
324 - name: Install Chromium for web browser tests
325 if: steps.chromium_cache.outputs.cache-hit != 'true'
326 run: node apps/web/node_modules/playwright/cli.js install --only-shell chromium
327
328 - name: Install missing Chromium system dependencies
329 run: |
330 browser=$(find "$HOME/.cache/ms-playwright" -name chrome-headless-shell -type f -print -quit)
331 test -n "$browser"
332 if ldd "$browser" | grep '=> not found'; then
333 node apps/web/node_modules/playwright/cli.js install-deps chromium
334 fi
335
336 - name: Test
337 run: vp run --filter @t3tools/web test
338
339 # Server test files run one at a time, so more small runners beat fewer big ones.
340 test_server:
341 name: Release server tests ${{ matrix.shard }}
342 needs: [preflight]
343 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
344 runs-on: blacksmith-4vcpu-ubuntu-2404
345 timeout-minutes: 10
346 strategy:
347 fail-fast: false
348 matrix:
349 shard: [1, 2, 3, 4, 5, 6, 7, 8]
350 steps:
351 - name: Checkout
352 uses: actions/checkout@v6
353 with:
354 ref: ${{ needs.preflight.outputs.ref }}
355 sparse-checkout: |
356 /*
357 !/.repos/
358 sparse-checkout-cone-mode: false
359
360 - name: Setup dependencies
361 uses: ./.github/actions/setup-ci-deps
362
363 # No Electron setup here: `t3` (apps/server) has no Electron dependency
364 # and none of its tests touch the runtime. Only the non-server `test`
365 # job, which covers @t3tools/desktop, needs the download.
366 - name: Install Chromium for server browser integration tests
367 run: node apps/server/node_modules/playwright-core/cli.js install --with-deps --only-shell chromium
368
369 - name: Test
370 run: vp run --filter t3 test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
371
372 relay_public_config:
373 name: Resolve T3 Connect public config
374 # Consumes only the release commit, not preflight's resolved version, so it
375 # runs alongside preflight instead of after it. The condition mirrors preflight's.
376 needs: [resolve_commit]
377 if: |
378 needs.resolve_commit.result == 'success' &&
379 (github.event_name != 'schedule' || needs.resolve_commit.outputs.has_changes == 'true')
380 runs-on: blacksmith-8vcpu-ubuntu-2404
381 timeout-minutes: 5
382 environment:
383 name: production
384 outputs:
385 clerk_publishable_key: ${{ steps.public_config.outputs.clerk_publishable_key }}
386 clerk_jwt_template: ${{ steps.public_config.outputs.clerk_jwt_template }}
387 clerk_cli_oauth_client_id: ${{ steps.public_config.outputs.clerk_cli_oauth_client_id }}
388 relay_url: ${{ steps.public_config.outputs.relay_url }}
389 env:
390 CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
391 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
392 RELAY_DOMAIN: ${{ vars.RELAY_DOMAIN }}
393 RELAY_API_ZONE_NAME: ${{ vars.RELAY_API_ZONE_NAME }}
394 CLERK_PUBLISHABLE_KEY: ${{ vars.CLERK_PUBLISHABLE_KEY }}
395 CLERK_JWT_TEMPLATE: ${{ vars.CLERK_JWT_TEMPLATE }}
396 CLERK_CLI_OAUTH_CLIENT_ID: ${{ vars.CLERK_CLI_OAUTH_CLIENT_ID }}
397 steps:
398 - name: Checkout
399 uses: actions/checkout@v6
400 with:
401 ref: ${{ needs.resolve_commit.outputs.ref }}
402 sparse-checkout: |
403 /*
404 !/.repos/
405 sparse-checkout-cone-mode: false
406
407 - name: Setup Vite+
408 uses: voidzero-dev/setup-vp@v1
409 with:
410 node-version-file: package.json
411 cache: true
412 run-install: |
413 args:
414 - --filter=t3code-relay...
415
416 # The deployed stack's outputs, read from Alchemy's state store without
417 # planning or applying. Select the backend explicitly to avoid loading
418 # the stack's unrelated provider credentials; suppress informational logs
419 # and strip the credential-refresh progress prefix before parsing JSON.
420 # Redacted values are persisted as
421 # {"__redacted__": "<value>"}; the token is masked before it is written.
422 - name: Read production relay tracing config
423 shell: bash
424 working-directory: infra/relay
425 run: |
426 set -euo pipefail
427 output="$(npx alchemy state read T3CodeRelay/prod/output --backend cloudflare --log-level error --no-input | sed -n '/^{/,$p')"
428 field() {
429 jq -er --arg key "$1" '.[$key] | if type == "object" then .__redacted__ else . end | select(. != null and . != "")' <<<"$output" \
430 || { echo "Relay stack output is missing $1" >&2; exit 1; }
431 }
432 url="$(field clientTracingUrl)"
433 dataset="$(field clientTracingDataset)"
434 token="$(field clientTracingToken)"
435 echo "::add-mask::$token"
436 {
437 echo "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=$url"
438 echo "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=$dataset"
439 echo "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=$token"
440 } > "$RUNNER_TEMP/relay-client-tracing.env"
441
442 - name: Upload relay client tracing config
443 uses: actions/upload-artifact@v7
444 with:
445 name: relay-client-tracing-config
446 path: ${{ runner.temp }}/relay-client-tracing.env
447 if-no-files-found: error
448 retention-days: 1
449
450 - id: public_config
451 name: Resolve production relay public config
452 shell: bash
453 run: |
454 set -euo pipefail
455
456 relay_domain="${RELAY_DOMAIN:-}"
457 if [[ -z "$relay_domain" && -n "${RELAY_API_ZONE_NAME:-}" ]]; then
458 relay_domain="relay.$RELAY_API_ZONE_NAME"
459 fi
460 required=(
461 relay_domain
462 CLERK_PUBLISHABLE_KEY
463 CLERK_JWT_TEMPLATE
464 CLERK_CLI_OAUTH_CLIENT_ID
465 )
466 missing=()
467 for name in "${required[@]}"; do
468 if [[ -z "${!name:-}" ]]; then
469 missing+=("$name")
470 fi
471 done
472 if (( ${#missing[@]} > 0 )); then
473 printf 'Missing required relay deployment configuration: %s\n' "${missing[*]}" >&2
474 exit 1
475 fi
476
477 echo "clerk_publishable_key=$CLERK_PUBLISHABLE_KEY" >> "$GITHUB_OUTPUT"
478 echo "clerk_jwt_template=$CLERK_JWT_TEMPLATE" >> "$GITHUB_OUTPUT"
479 echo "clerk_cli_oauth_client_id=$CLERK_CLI_OAUTH_CLIENT_ID" >> "$GITHUB_OUTPUT"
480 echo "relay_url=https://$relay_domain" >> "$GITHUB_OUTPUT"
481
482 # The platform-independent JS (server bundle, web client, Electron main) is
483 # built exactly once here and handed to every platform job as `js-bundle`.
484 # The relay/Clerk values are baked into the bundle, so they belong to this
485 # job rather than to the packaging jobs.
486 build_bundle:
487 name: Build JS bundle
488 # Same gating as relay_public_config: only the release commit is needed, so
489 # this runs alongside preflight. See the condition comment there.
490 needs: [preflight, relay_public_config]
491 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' }}
492 runs-on: blacksmith-32vcpu-ubuntu-2404
493 timeout-minutes: 30
494 env:
495 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
496 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
497 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
498 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
499 steps:
500 - name: Checkout
501 uses: actions/checkout@v6
502 with:
503 ref: ${{ needs.preflight.outputs.ref }}
504 sparse-checkout: |
505 /*
506 !/.repos/
507 sparse-checkout-cone-mode: false
508
509 - name: Setup Vite+
510 uses: voidzero-dev/setup-vp@v1
511 with:
512 node-version-file: package.json
513 cache: true
514 run-install: false
515
516 # pnpm checks the lockfile and policy before reusing this result. A missing
517 # artifact leaves the cache empty, so installation runs the checks again.
518 - name: Download dependency verification
519 continue-on-error: true
520 uses: actions/download-artifact@v8
521 with:
522 name: release-dependency-verification
523 path: ${{ runner.temp }}/pnpm-metadata
524
525 - name: Install bundle dependencies
526 env:
527 pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
528 run: vp install --filter=t3... --filter=@t3tools/web... --filter=@t3tools/desktop... --filter=@t3tools/scripts...
529
530 - name: Download relay client tracing config
531 uses: actions/download-artifact@v8
532 with:
533 name: relay-client-tracing-config
534 path: ${{ runner.temp }}/relay-client-tracing
535
536 - name: Load relay client tracing config
537 shell: bash
538 run: |
539 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
540 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
541 echo "::add-mask::$tracing_token"
542 cat "$config_path" >> "$GITHUB_ENV"
543
544 - name: Align package versions to release version
545 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
546
547 - uses: ./.github/actions/setup-apt-mirrors
548
549 # @t3tools/desktop#build compiles the Linux browser secret helper on a
550 # Linux host before packing, and that needs libsecret headers.
551 - name: Install browser secret helper build libraries
552 run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
553
554 # Runs t3#build (which depends on @t3tools/web#build) and
555 # @t3tools/desktop#build, so apps/server/dist holds the server bundle
556 # plus the web client and apps/desktop/dist-electron the Electron main.
557 # The release channel is already stable, nightly, or preview. Builds in
558 # other repositories report "dev" telemetry.
559 - name: Build JS bundle
560 env:
561 T3CODE_TELEMETRY_CHANNEL: ${{ github.repository == 'pingdotgg/t3code' && needs.preflight.outputs.release_channel || 'dev' }}
562 run: vp run build:desktop
563
564 # Two paths under apps/ so the artifact root is apps/; consumers download
565 # into `apps` to restore both at their original locations.
566 - name: Upload JS bundle
567 uses: actions/upload-artifact@v7
568 with:
569 name: js-bundle
570 path: |
571 apps/server/dist
572 apps/desktop/dist-electron
573 if-no-files-found: error
574 retention-days: 1
575
576 # One job per platform and architecture (see release-desktop.yml), each
577 # gated only on the JS bundle. Windows targets build on Linux and run their
578 # native checks on a Windows runner of their own architecture.
579 # The Windows jobs also embed the same-arch Linux CLI archive as the WSL
580 # runtime; they wait for that artifact partway through instead of for the
581 # whole Linux job. Every job builds the desktop app; all but macOS x64 also
582 # build the CLI archive for their platform, so a target either ships fully or
583 # not at all.
584 desktop_mac_arm64:
585 name: Desktop macOS arm64
586 needs: [preflight, relay_public_config, build_bundle]
587 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
588 uses: ./.github/workflows/release-desktop.yml
589 secrets: inherit
590 with:
591 version: ${{ needs.preflight.outputs.version }}
592 ref: ${{ needs.preflight.outputs.ref }}
593 release_channel: ${{ needs.preflight.outputs.release_channel }}
594 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
595 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
596 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
597 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
598 label: macOS arm64
599 runner: blacksmith-12vcpu-macos-26
600 platform: mac
601 target: dmg
602 arch: arm64
603 rust_target: aarch64-apple-darwin
604 resource_key: darwin-arm64
605 cli_archive: true
606
607 desktop_mac_x64:
608 name: Desktop macOS x64
609 needs: [preflight, relay_public_config, build_bundle]
610 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
611 uses: ./.github/workflows/release-desktop.yml
612 secrets: inherit
613 with:
614 version: ${{ needs.preflight.outputs.version }}
615 ref: ${{ needs.preflight.outputs.ref }}
616 release_channel: ${{ needs.preflight.outputs.release_channel }}
617 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
618 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
619 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
620 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
621 label: macOS x64
622 runner: blacksmith-12vcpu-macos-26
623 platform: mac
624 target: dmg
625 arch: x64
626 rust_target: x86_64-apple-darwin
627 resource_key: darwin-x64
628 # No CLI archive: Node single-executables are unsupported on x64 macOS
629 # (the SEA docs list macOS as arm64 only) and the built binary segfaults
630 # on start. The x64 desktop app is Electron and unaffected.
631 cli_archive: false
632
633 desktop_linux_x64:
634 name: Desktop Linux x64
635 needs: [preflight, relay_public_config, build_bundle]
636 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
637 uses: ./.github/workflows/release-desktop.yml
638 secrets: inherit
639 with:
640 version: ${{ needs.preflight.outputs.version }}
641 ref: ${{ needs.preflight.outputs.ref }}
642 release_channel: ${{ needs.preflight.outputs.release_channel }}
643 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
644 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
645 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
646 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
647 label: Linux x64
648 runner: blacksmith-32vcpu-ubuntu-2404
649 platform: linux
650 target: AppImage
651 arch: x64
652 rust_target: x86_64-unknown-linux-gnu
653 resource_key: linux-x64
654 cli_archive: true
655
656 # node-pty has no Linux prebuild and compiles from source, so the arm64 app
657 # and archive are built on arm64 hardware rather than cross-built.
658 desktop_linux_arm64:
659 name: Desktop Linux arm64
660 needs: [preflight, relay_public_config, build_bundle]
661 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
662 uses: ./.github/workflows/release-desktop.yml
663 secrets: inherit
664 with:
665 version: ${{ needs.preflight.outputs.version }}
666 ref: ${{ needs.preflight.outputs.ref }}
667 release_channel: ${{ needs.preflight.outputs.release_channel }}
668 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
669 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
670 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
671 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
672 label: Linux arm64
673 runner: blacksmith-16vcpu-ubuntu-2404-arm
674 platform: linux
675 target: AppImage
676 arch: arm64
677 rust_target: aarch64-unknown-linux-gnu
678 resource_key: linux-arm64
679 cli_archive: true
680
681 # The Windows jobs start with the other platforms and wait for the same-arch
682 # Linux CLI archive after their other setup. Packaging is mostly CPU and
683 # small-file work, which Linux runners do faster than Windows ones, so both
684 # Windows targets build and sign on Linux and only the native checks run on
685 # Windows.
686 desktop_win_x64:
687 name: Desktop Windows x64
688 needs: [preflight, relay_public_config, build_bundle]
689 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
690 uses: ./.github/workflows/release-desktop.yml
691 secrets: inherit
692 with:
693 version: ${{ needs.preflight.outputs.version }}
694 ref: ${{ needs.preflight.outputs.ref }}
695 release_channel: ${{ needs.preflight.outputs.release_channel }}
696 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
697 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
698 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
699 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
700 label: Windows x64
701 runner: blacksmith-16vcpu-ubuntu-2404
702 verify_runner: windows-2025
703 platform: win
704 target: nsis
705 arch: x64
706 rust_target: x86_64-pc-windows-msvc
707 resource_key: win32-x64
708 cli_archive: true
709
710 desktop_win_arm64:
711 name: Desktop Windows arm64
712 needs: [preflight, relay_public_config, build_bundle]
713 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
714 uses: ./.github/workflows/release-desktop.yml
715 secrets: inherit
716 with:
717 version: ${{ needs.preflight.outputs.version }}
718 ref: ${{ needs.preflight.outputs.ref }}
719 release_channel: ${{ needs.preflight.outputs.release_channel }}
720 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
721 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
722 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
723 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
724 label: Windows arm64
725 runner: blacksmith-16vcpu-ubuntu-2404
726 verify_runner: windows-11-arm
727 platform: win
728 target: nsis
729 arch: arm64
730 rust_target: aarch64-pc-windows-msvc
731 resource_key: win32-arm64
732 cli_archive: true
733
734 release:
735 name: Publish GitHub Release
736 needs:
737 [
738 preflight,
739 relay_public_config,
740 quality,
741 test,
742 test_web,
743 test_server,
744 desktop_mac_arm64,
745 desktop_mac_x64,
746 desktop_linux_x64,
747 desktop_linux_arm64,
748 desktop_win_x64,
749 desktop_win_arm64,
750 ]
751 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.test.result == 'success' && needs.test_web.result == 'success' && needs.test_server.result == 'success' && needs.desktop_mac_arm64.result == 'success' && needs.desktop_mac_x64.result == 'success' && needs.desktop_linux_x64.result == 'success' && needs.desktop_linux_arm64.result == 'success' && needs.desktop_win_x64.result == 'success' && needs.desktop_win_arm64.result == 'success' }}
752 runs-on: blacksmith-8vcpu-ubuntu-2404
753 timeout-minutes: 30
754 permissions:
755 contents: write
756 steps:
757 - name: Checkout
758 uses: actions/checkout@v6
759 with:
760 ref: ${{ needs.preflight.outputs.ref }}
761 sparse-checkout: |
762 /*
763 !/.repos/
764 sparse-checkout-cone-mode: false
765
766 - name: Setup Vite+
767 uses: voidzero-dev/setup-vp@v1
768 with:
769 node-version-file: package.json
770 cache: true
771 run-install: |
772 args:
773 - --filter=@t3tools/scripts...
774
775 - name: Download all desktop artifacts
776 uses: actions/download-artifact@v8
777 with:
778 pattern: desktop-*
779 merge-multiple: true
780 path: release-assets
781
782 - name: Download all CLI archives
783 uses: actions/download-artifact@v8
784 with:
785 pattern: cli-*
786 merge-multiple: true
787 path: release-assets
788
789 - name: Download internal Android APK for Nightly
790 if: needs.preflight.outputs.release_channel == 'nightly'
791 continue-on-error: true
792 env:
793 GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
794 PACKAGE_NAME: com.t3tools.t3code
795 APK_OUTPUT_DIR: release-assets
796 run: |
797 if [ -n "$GOOGLE_PLAY_SERVICE_ACCOUNT_JSON" ]; then
798 node .github/scripts/mirror-play-apk.cjs
799 fi
800
801 # Installers verify archives against this file, so it is written from the
802 # signed bytes that get uploaded, never from an earlier stage.
803 - name: Write CLI archive checksums
804 shell: bash
805 run: |
806 set -euo pipefail
807 cd release-assets
808 shopt -s nullglob
809 archives=(t3-*.tar.gz t3-*.zip)
810 if [[ ${#archives[@]} -eq 0 ]]; then
811 echo "No CLI archives were produced." >&2
812 exit 1
813 fi
814 sha256sum "${archives[@]}" > SHA256SUMS
815 cat SHA256SUMS
816
817 # The desktop build omits the publish config for preview versions, so
818 # electron-builder emits no updater manifests for them. Refuse to publish
819 # if one shows up anyway: a `latest*.yml` or `nightly*.yml` on a preview
820 # release is what would let a stable or nightly install update onto it.
821 - name: Refuse updater metadata on preview releases
822 if: needs.preflight.outputs.release_channel == 'preview'
823 shell: bash
824 run: |
825 set -euo pipefail
826 shopt -s nullglob extglob
827 # builder-debug.yml is electron-builder's config dump, not a feed.
828 updater_files=(release-assets/!(builder-debug).yml release-assets/*.blockmap)
829 if [[ ${#updater_files[@]} -ne 0 ]]; then
830 printf 'Preview releases must not carry updater metadata, found: %s\n' "${updater_files[*]}" >&2
831 exit 1
832 fi
833
834 # electron-updater reads one manifest per platform and channel and picks
835 # the file entry whose name carries the running arch, so the per-arch
836 # manifests the build jobs wrote are merged back into that one file.
837 - name: Merge macOS updater manifests
838 if: needs.preflight.outputs.release_channel != 'preview'
839 run: |
840 shopt -s nullglob
841 for x64_manifest in release-assets/*-mac-x64.yml; do
842 arm64_manifest="${x64_manifest%-x64.yml}.yml"
843 if [[ -f "$arm64_manifest" ]]; then
844 node scripts/merge-update-manifests.ts --platform mac "$arm64_manifest" "$x64_manifest"
845 rm -f "$x64_manifest"
846 fi
847 done
848
849 - name: Merge Windows updater manifests
850 if: needs.preflight.outputs.release_channel != 'preview'
851 run: |
852 shopt -s nullglob
853 for x64_manifest in release-assets/*-win-x64.yml; do
854 arm64_manifest="${x64_manifest%-x64.yml}-arm64.yml"
855 merged_manifest="${x64_manifest%-win-x64.yml}.yml"
856 if [[ -f "$arm64_manifest" ]]; then
857 node scripts/merge-update-manifests.ts --platform win "$x64_manifest" "$arm64_manifest" "$merged_manifest"
858 rm -f "$x64_manifest" "$arm64_manifest"
859 else
860 mv "$x64_manifest" "$merged_manifest"
861 fi
862 done
863
864 # Updater manifests and blockmaps are what electron-updater consumes.
865 # They are only listed for channels an updater is meant to follow.
866 - id: release_files
867 name: Resolve release asset list
868 shell: bash
869 run: |
870 {
871 echo 'files<<EOF'
872 echo 'release-assets/*.dmg'
873 echo 'release-assets/*.zip'
874 echo 'release-assets/*.AppImage'
875 echo 'release-assets/*.deb'
876 echo 'release-assets/*.exe'
877 if [[ "${{ needs.preflight.outputs.release_channel }}" != "preview" ]]; then
878 echo 'release-assets/*.blockmap'
879 echo 'release-assets/*.yml'
880 fi
881 echo 'release-assets/*.tar.gz'
882 # Only list APKs when Play has a processed internal build available.
883 for apk in release-assets/*.apk; do
884 [[ -f "$apk" ]] && echo "$apk"
885 done
886 echo 'release-assets/SHA256SUMS'
887 echo 'EOF'
888 } >> "$GITHUB_OUTPUT"
889
890 # A preview release gets a warning instead of generated notes. Generated
891 # notes would list every commit since the previous preview, which is
892 # unmerged branch history no one should read as a changelog, and would
893 # make the release look like any other build to someone browsing the
894 # releases page.
895 - name: Write preview release notes
896 if: needs.preflight.outputs.release_channel == 'preview'
897 shell: bash
898 run: |
899 cat > release-notes.md <<'EOF'
900 > [!WARNING]
901 > **This is a preview build. Do not install it unless you know exactly why you are here.**
902 >
903 > Preview builds are cut by maintainers from unreleased branches to exercise the release pipeline. They can be broken, receive no fixes, are never offered as updates, and are not supported. If you want T3 Code, install the [latest release](https://github.com/pingdotgg/t3code/releases/latest) or a nightly instead.
904
905 Built from `${{ needs.preflight.outputs.ref }}`.
906 EOF
907
908 - name: Publish release
909 if: needs.preflight.outputs.previous_tag != ''
910 uses: softprops/action-gh-release@v3
911 with:
912 tag_name: ${{ needs.preflight.outputs.tag }}
913 target_commitish: ${{ needs.preflight.outputs.ref }}
914 name: ${{ needs.preflight.outputs.release_name }}
915 generate_release_notes: ${{ needs.preflight.outputs.release_channel != 'preview' }}
916 body_path: ${{ needs.preflight.outputs.release_channel == 'preview' && 'release-notes.md' || '' }}
917 previous_tag: ${{ needs.preflight.outputs.previous_tag }}
918 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
919 make_latest: ${{ needs.preflight.outputs.make_latest }}
920 files: ${{ steps.release_files.outputs.files }}
921 fail_on_unmatched_files: true
922 token: ${{ github.token }}
923
924 - name: Publish first release
925 if: needs.preflight.outputs.previous_tag == ''
926 uses: softprops/action-gh-release@v3
927 with:
928 tag_name: ${{ needs.preflight.outputs.tag }}
929 target_commitish: ${{ needs.preflight.outputs.ref }}
930 name: ${{ needs.preflight.outputs.release_name }}
931 generate_release_notes: ${{ needs.preflight.outputs.release_channel != 'preview' }}
932 body_path: ${{ needs.preflight.outputs.release_channel == 'preview' && 'release-notes.md' || '' }}
933 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
934 make_latest: ${{ needs.preflight.outputs.make_latest }}
935 files: ${{ steps.release_files.outputs.files }}
936 fail_on_unmatched_files: true
937 token: ${{ github.token }}
938
939 # The `t3` npm package is a launcher that downloads this version's CLI
940 # archive from the GitHub Release, so it publishes only once that release
941 # exists. Preview publishes too, under the `preview` dist-tag, which
942 # nothing resolves unless asked for by name.
943 publish_cli:
944 name: Publish CLI to npm
945 needs: [preflight, release]
946 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
947 runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
948 timeout-minutes: 15
949 permissions:
950 contents: read
951 id-token: write
952 steps:
953 - name: Checkout
954 uses: actions/checkout@v6
955 with:
956 ref: ${{ needs.preflight.outputs.ref }}
957 sparse-checkout: |
958 /*
959 !/.repos/
960 sparse-checkout-cone-mode: false
961
962 - name: Setup Vite+
963 uses: voidzero-dev/setup-vp@v1
964 with:
965 node-version-file: package.json
966 cache: true
967 run-install: |
968 args:
969 - --filter=t3...
970 - --filter=@t3tools/scripts...
971
972 - name: Build the npm launcher
973 run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
974
975 - name: Publish the npm launcher
976 run: |
977 if ! node apps/server/scripts/cli.ts publish --packages-dir npm-packages --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --provenance --verbose; then
978 echo "::error::npm publish failed. Make sure package t3 has a trusted publisher registered for .github/workflows/release.yml (see docs/operations/release.md)." >&2
979 exit 1
980 fi
981
982 publish_aur:
983 name: Publish AUR package
984 needs: [preflight, release]
985 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
986 uses: ./.github/workflows/publish-aur.yml
987 with:
988 release_tag: ${{ needs.preflight.outputs.tag }}
989 secrets:
990 AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
991
992 # Vercel builds the hosted web app while the desktop jobs run. `--skip-domain`
993 # keeps the custom domains (the channel and router domains) on the previous
994 # deployment until deploy_web aliases them, after the GitHub Release. It does
995 # still move the project's own *.vercel.app production hostname at build time.
996 # That hostname sits behind Vercel SSO and is not a user channel, so the
997 # npm-before-client order in docs/operations/release.md holds for users.
998 build_web:
999 name: Build hosted web app
1000 needs: [preflight, relay_public_config]
1001 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
1002 runs-on: blacksmith-8vcpu-ubuntu-2404
1003 timeout-minutes: 10
1004 outputs:
1005 deployment_url: ${{ steps.deploy.outputs.deployment_url }}
1006 env:
1007 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
1008 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
1009 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
1010 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
1011 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1012 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1013 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1014 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
1015 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1016 steps:
1017 - name: Checkout
1018 uses: actions/checkout@v6
1019 with:
1020 ref: ${{ needs.preflight.outputs.ref }}
1021 sparse-checkout: |
1022 /*
1023 !/.repos/
1024 sparse-checkout-cone-mode: false
1025
1026 - name: Setup Vite+
1027 uses: voidzero-dev/setup-vp@v1
1028 with:
1029 node-version-file: package.json
1030 cache: true
1031 run-install: |
1032 args:
1033 - --filter=@t3tools/scripts...
1034 - --filter=@t3tools/web...
1035
1036 - name: Download relay client tracing config
1037 uses: actions/download-artifact@v8
1038 with:
1039 name: relay-client-tracing-config
1040 path: ${{ runner.temp }}/relay-client-tracing
1041
1042 - name: Load relay client tracing config
1043 shell: bash
1044 run: |
1045 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
1046 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
1047 echo "::add-mask::$tracing_token"
1048 cat "$config_path" >> "$GITHUB_ENV"
1049
1050 - name: Align package versions to release version
1051 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
1052
1053 - name: Refresh release lockfile
1054 run: vp install --lockfile-only --ignore-scripts
1055
1056 - id: deploy
1057 name: Build staged deployment
1058 shell: bash
1059 run: |
1060 set -euo pipefail
1061
1062 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" || -z "${VERCEL_PROJECT_ID:-}" ]]; then
1063 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID." >&2
1064 exit 1
1065 fi
1066
1067 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
1068 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
1069 channel_name="latest"
1070 else
1071 channel_name="nightly"
1072 fi
1073
1074 echo "Building hosted web app for $channel_name channel."
1075 deployment_output="$(
1076 vp dlx vercel@53.1.1 deploy \
1077 --archive=tgz \
1078 --prod \
1079 --skip-domain \
1080 --yes \
1081 --token "$VERCEL_TOKEN" \
1082 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}" \
1083 --build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
1084 --build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
1085 --build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
1086 --build-env "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID=${T3CODE_CLERK_CLI_OAUTH_CLIENT_ID:-}" \
1087 --build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
1088 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=${T3CODE_RELAY_CLIENT_OTLP_TRACES_URL:-}" \
1089 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=${T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET:-}" \
1090 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=${T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN:-}" \
1091 --build-env "VITE_HOSTED_APP_URL=$router_url" \
1092 --build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
1093 )"
1094 printf '%s\n' "$deployment_output"
1095 # Vercel can print lockfile warnings to stdout before the deployment URL.
1096 deployment_url="$(printf '%s\n' "$deployment_output" | grep -E '^https://[[:alnum:].-]+\.vercel\.app$')"
1097 if [[ "$deployment_url" == *$'\n'* ]]; then
1098 echo "Vercel returned multiple deployment URLs." >&2
1099 exit 1
1100 fi
1101 echo "Staged $deployment_url."
1102 echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"
1103
1104 deploy_web:
1105 name: Deploy hosted web app
1106 needs: [preflight, build_web, release, publish_cli]
1107 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build_web.result == 'success' && needs.release.result == 'success' && needs.publish_cli.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
1108 runs-on: blacksmith-2vcpu-ubuntu-2404
1109 timeout-minutes: 10
1110 env:
1111 DEPLOYMENT_URL: ${{ needs.build_web.outputs.deployment_url }}
1112 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1113 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1114 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1115 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
1116 T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
1117 T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
1118 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1119 steps:
1120 - name: Checkout
1121 uses: actions/checkout@v6
1122 with:
1123 ref: ${{ needs.preflight.outputs.ref }}
1124 sparse-checkout: |
1125 /*
1126 !/.repos/
1127 sparse-checkout-cone-mode: false
1128
1129 - name: Setup Vite+
1130 uses: voidzero-dev/setup-vp@v1
1131 with:
1132 node-version-file: package.json
1133 cache: false
1134 run-install: false
1135
1136 - name: Alias channel
1137 shell: bash
1138 run: |
1139 set -euo pipefail
1140
1141 if [[ -z "$DEPLOYMENT_URL" ]]; then
1142 echo "Build hosted web app did not report a deployment URL." >&2
1143 exit 1
1144 fi
1145
1146 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
1147 latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
1148 nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
1149 router_domain="${router_url#http://}"
1150 router_domain="${router_domain#https://}"
1151 router_domain="${router_domain%%/*}"
1152
1153 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
1154 channel_domain="$latest_domain"
1155 channel_name="latest"
1156 else
1157 channel_domain="$nightly_domain"
1158 channel_name="nightly"
1159 fi
1160
1161 vercel_scope_args=(--scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}")
1162
1163 echo "Aliasing $DEPLOYMENT_URL to $channel_domain."
1164 vp dlx vercel@53.1.1 alias set "$DEPLOYMENT_URL" "$channel_domain" \
1165 --token "$VERCEL_TOKEN" \
1166 "${vercel_scope_args[@]}"
1167
1168 if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
1169 echo "Aliasing $DEPLOYMENT_URL to router domain $router_domain."
1170 vp dlx vercel@53.1.1 alias set "$DEPLOYMENT_URL" "$router_domain" \
1171 --token "$VERCEL_TOKEN" \
1172 "${vercel_scope_args[@]}"
1173 fi
1174
1175 # Same split as the web app: build a production deployment early, then
1176 # promote it to t3.codes once the release it links to exists. As above, the
1177 # project's own *.vercel.app hostname moves at build time.
1178 build_marketing:
1179 name: Build marketing site
1180 needs: [preflight]
1181 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
1182 runs-on: blacksmith-8vcpu-ubuntu-2404
1183 timeout-minutes: 10
1184 outputs:
1185 deployment_url: ${{ steps.deploy.outputs.deployment_url }}
1186 project_id: ${{ steps.deploy.outputs.project_id }}
1187 env:
1188 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1189 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1190 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1191 steps:
1192 - name: Checkout
1193 uses: actions/checkout@v6
1194 with:
1195 ref: ${{ needs.preflight.outputs.ref }}
1196 sparse-checkout: |
1197 /*
1198 !/.repos/
1199 sparse-checkout-cone-mode: false
1200
1201 - name: Setup Vite+
1202 uses: voidzero-dev/setup-vp@v1
1203 with:
1204 node-version-file: package.json
1205 cache: true
1206 run-install: |
1207 args:
1208 - --filter=@t3tools/marketing...
1209
1210 - id: deploy
1211 name: Build staged deployment
1212 shell: bash
1213 run: |
1214 set -euo pipefail
1215
1216 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" ]]; then
1217 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID." >&2
1218 exit 1
1219 fi
1220
1221 VERCEL_PROJECT_ID="$(
1222 curl --fail --silent --show-error \
1223 --header "Authorization: Bearer $VERCEL_TOKEN" \
1224 "https://api.vercel.com/v9/projects/t3code-marketing?teamId=$VERCEL_ORG_ID" \
1225 | jq --exit-status --raw-output '.id'
1226 )"
1227 export VERCEL_PROJECT_ID
1228
1229 deployment_output="$(
1230 vp dlx vercel@53.1.1 deploy \
1231 --archive=tgz \
1232 --prod \
1233 --skip-domain \
1234 --yes \
1235 --token "$VERCEL_TOKEN" \
1236 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1237 )"
1238 printf '%s\n' "$deployment_output"
1239 # Vercel can print lockfile warnings to stdout before the deployment URL.
1240 deployment_url="$(printf '%s\n' "$deployment_output" | grep -E '^https://[[:alnum:].-]+\.vercel\.app$')"
1241 if [[ "$deployment_url" == *$'\n'* ]]; then
1242 echo "Vercel returned multiple deployment URLs." >&2
1243 exit 1
1244 fi
1245 echo "Staged $deployment_url."
1246 echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"
1247 echo "project_id=$VERCEL_PROJECT_ID" >> "$GITHUB_OUTPUT"
1248
1249 deploy_marketing:
1250 name: Deploy marketing site
1251 needs: [preflight, build_marketing, release]
1252 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build_marketing.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
1253 runs-on: blacksmith-2vcpu-ubuntu-2404
1254 timeout-minutes: 10
1255 env:
1256 DEPLOYMENT_URL: ${{ needs.build_marketing.outputs.deployment_url }}
1257 VERCEL_PROJECT_ID: ${{ needs.build_marketing.outputs.project_id }}
1258 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1259 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1260 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1261 steps:
1262 - name: Checkout
1263 uses: actions/checkout@v6
1264 with:
1265 ref: ${{ needs.preflight.outputs.ref }}
1266 sparse-checkout: |
1267 /*
1268 !/.repos/
1269 sparse-checkout-cone-mode: false
1270
1271 - name: Setup Vite+
1272 uses: voidzero-dev/setup-vp@v1
1273 with:
1274 node-version-file: package.json
1275 cache: false
1276 run-install: false
1277
1278 - name: Promote marketing site
1279 shell: bash
1280 run: |
1281 set -euo pipefail
1282
1283 if [[ -z "$DEPLOYMENT_URL" ]]; then
1284 echo "Build marketing site did not report a deployment URL." >&2
1285 exit 1
1286 fi
1287
1288 echo "Promoting $DEPLOYMENT_URL."
1289 vp dlx vercel@53.1.1 promote "$DEPLOYMENT_URL" \
1290 --yes \
1291 --token "$VERCEL_TOKEN" \
1292 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1293
1294 finalize:
1295 name: Finalize release
1296 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
1297 needs: [preflight, release]
1298 runs-on: blacksmith-8vcpu-ubuntu-2404
1299 timeout-minutes: 10
1300 steps:
1301 - id: app_token
1302 name: Mint release app token
1303 uses: actions/create-github-app-token@v2
1304 with:
1305 app-id: ${{ secrets.RELEASE_APP_ID }}
1306 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
1307 owner: ${{ github.repository_owner }}
1308
1309 - name: Checkout
1310 uses: actions/checkout@v6
1311 with:
1312 ref: main
1313 fetch-depth: 0
1314 token: ${{ steps.app_token.outputs.token }}
1315 persist-credentials: true
1316 sparse-checkout: |
1317 /*
1318 !/.repos/
1319 sparse-checkout-cone-mode: false
1320
1321 - id: app_bot
1322 name: Resolve GitHub App bot identity
1323 env:
1324 GH_TOKEN: ${{ steps.app_token.outputs.token }}
1325 APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
1326 run: |
1327 user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
1328 echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
1329 echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
1330
1331 - name: Setup Vite+
1332 uses: voidzero-dev/setup-vp@v1
1333 with:
1334 node-version-file: package.json
1335 cache: true
1336 run-install: |
1337 args:
1338 - --filter=@t3tools/scripts...
1339 - --filter=@t3tools/oxlint-plugin-t3code...
1340
1341 - id: update_versions
1342 name: Update version strings
1343 env:
1344 RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
1345 run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
1346
1347 - name: Format package.json files
1348 if: steps.update_versions.outputs.changed == 'true'
1349 run: vp fmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
1350
1351 - name: Refresh lockfile
1352 if: steps.update_versions.outputs.changed == 'true'
1353 run: vp install --lockfile-only --ignore-scripts
1354
1355 - name: Commit and push version bump
1356 if: steps.update_versions.outputs.changed == 'true'
1357 shell: bash
1358 env:
1359 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
1360 run: |
1361 if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml; then
1362 echo "No version changes to commit."
1363 exit 0
1364 fi
1365
1366 git config user.name "${{ steps.app_bot.outputs.name }}"
1367 git config user.email "${{ steps.app_bot.outputs.email }}"
1368
1369 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
1370 git commit -m "chore(release): prepare $RELEASE_TAG"
1371 git push origin HEAD:main
1372
1373 announce_discord:
1374 name: Announce release on Discord
1375 if: |
1376 always() && !cancelled() &&
1377 needs.preflight.result == 'success' &&
1378 needs.preflight.outputs.release_channel != 'preview' &&
1379 needs.relay_public_config.result == 'success' &&
1380 needs.release.result == 'success' &&
1381 needs.deploy_web.result == 'success' &&
1382 (needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
1383 needs: [preflight, relay_public_config, release, deploy_web, finalize]
1384 runs-on: blacksmith-8vcpu-ubuntu-2404
1385 timeout-minutes: 10
1386 steps:
1387 - name: Checkout
1388 uses: actions/checkout@v6
1389 with:
1390 ref: ${{ needs.preflight.outputs.ref }}
1391 sparse-checkout: |
1392 /*
1393 !/.repos/
1394 sparse-checkout-cone-mode: false
1395
1396 - name: Setup Vite+
1397 uses: voidzero-dev/setup-vp@v1
1398 with:
1399 node-version-file: package.json
1400 cache: true
1401 run-install: |
1402 args:
1403 - --filter=@t3tools/scripts...
1404
1405 - name: Read published release notes
1406 if: needs.preflight.outputs.is_prerelease == 'true'
1407 continue-on-error: true
1408 env:
1409 GH_TOKEN: ${{ github.token }}
1410 GH_REPO: ${{ github.repository }}
1411 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
1412 RELEASE_CHANNEL: ${{ needs.preflight.outputs.release_channel }}
1413 run: |
1414 if [ "$RELEASE_CHANNEL" = 'nightly' ]; then
1415 if ! gh release view "$RELEASE_TAG" --json body --jq '.body // ""' > "$RUNNER_TEMP/discord-release-notes.md"; then
1416 : > "$RUNNER_TEMP/discord-release-notes.md"
1417 echo '::warning::Could not read published release notes; announcing without a changelog.'
1418 fi
1419 else
1420 : > "$RUNNER_TEMP/discord-release-notes.md"
1421 fi
1422
1423 - name: Announce prerelease on Discord
1424 if: needs.preflight.outputs.is_prerelease == 'true'
1425 continue-on-error: true
1426 env:
1427 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_NIGHTLY_ROLE_ID }}
1428 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1429 run: |
1430 node scripts/notify-discord-release.ts prerelease \
1431 --role-id "$DISCORD_MENTION_ROLE_ID" \
1432 --release-name "${{ needs.preflight.outputs.release_name }}" \
1433 --release-version "${{ needs.preflight.outputs.version }}" \
1434 --tag "${{ needs.preflight.outputs.tag }}" \
1435 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}" \
1436 --release-notes-file "$RUNNER_TEMP/discord-release-notes.md"
1437
1438 - name: Announce latest release on Discord
1439 if: needs.preflight.outputs.make_latest == 'true'
1440 continue-on-error: true
1441 env:
1442 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_LATEST_ROLE_ID }}
1443 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1444 run: |
1445 node scripts/notify-discord-release.ts latest \
1446 --role-id "$DISCORD_MENTION_ROLE_ID" \
1447 --release-name "${{ needs.preflight.outputs.release_name }}" \
1448 --release-version "${{ needs.preflight.outputs.version }}" \
1449 --tag "${{ needs.preflight.outputs.tag }}" \
1450 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"