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