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 # The release channel is already stable, nightly, or preview. Builds in
529 # other repositories report "dev" telemetry.
530 - name: Build JS bundle
531 env:
532 T3CODE_TELEMETRY_CHANNEL: ${{ github.repository == 'pingdotgg/t3code' && needs.preflight.outputs.release_channel || 'dev' }}
533 run: vp run build:desktop
534
535 # Two paths under apps/ so the artifact root is apps/; consumers download
536 # into `apps` to restore both at their original locations.
537 - name: Upload JS bundle
538 uses: actions/upload-artifact@v7
539 with:
540 name: js-bundle
541 path: |
542 apps/server/dist
543 apps/desktop/dist-electron
544 if-no-files-found: error
545 retention-days: 1
546
547 # One job per platform and architecture (see release-desktop.yml), each on
548 # hardware of its own architecture, and each gated only on the JS bundle.
549 # The Windows jobs also embed the same-arch Linux CLI archive as the WSL
550 # runtime; they wait for that artifact partway through instead of for the
551 # whole Linux job. Every job builds the desktop app; all but macOS x64 also
552 # build the CLI archive for their platform, so a target either ships fully or
553 # not at all.
554 desktop_mac_arm64:
555 name: Desktop macOS arm64
556 needs: [preflight, relay_public_config, build_bundle]
557 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
558 uses: ./.github/workflows/release-desktop.yml
559 secrets: inherit
560 with:
561 version: ${{ needs.preflight.outputs.version }}
562 ref: ${{ needs.preflight.outputs.ref }}
563 release_channel: ${{ needs.preflight.outputs.release_channel }}
564 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
565 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
566 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
567 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
568 label: macOS arm64
569 runner: blacksmith-12vcpu-macos-26
570 platform: mac
571 target: dmg
572 arch: arm64
573 rust_target: aarch64-apple-darwin
574 resource_key: darwin-arm64
575 cli_archive: true
576
577 desktop_mac_x64:
578 name: Desktop macOS x64
579 needs: [preflight, relay_public_config, build_bundle]
580 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
581 uses: ./.github/workflows/release-desktop.yml
582 secrets: inherit
583 with:
584 version: ${{ needs.preflight.outputs.version }}
585 ref: ${{ needs.preflight.outputs.ref }}
586 release_channel: ${{ needs.preflight.outputs.release_channel }}
587 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
588 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
589 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
590 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
591 label: macOS x64
592 runner: blacksmith-12vcpu-macos-26
593 platform: mac
594 target: dmg
595 arch: x64
596 rust_target: x86_64-apple-darwin
597 resource_key: darwin-x64
598 # No CLI archive: Node single-executables are unsupported on x64 macOS
599 # (the SEA docs list macOS as arm64 only) and the built binary segfaults
600 # on start. The x64 desktop app is Electron and unaffected.
601 cli_archive: false
602
603 desktop_linux_x64:
604 name: Desktop Linux x64
605 needs: [preflight, relay_public_config, build_bundle]
606 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
607 uses: ./.github/workflows/release-desktop.yml
608 secrets: inherit
609 with:
610 version: ${{ needs.preflight.outputs.version }}
611 ref: ${{ needs.preflight.outputs.ref }}
612 release_channel: ${{ needs.preflight.outputs.release_channel }}
613 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
614 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
615 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
616 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
617 label: Linux x64
618 runner: blacksmith-32vcpu-ubuntu-2404
619 platform: linux
620 target: AppImage
621 arch: x64
622 rust_target: x86_64-unknown-linux-gnu
623 resource_key: linux-x64
624 cli_archive: true
625
626 # node-pty has no Linux prebuild and compiles from source, so the arm64 app
627 # and archive are built on arm64 hardware rather than cross-built.
628 desktop_linux_arm64:
629 name: Desktop Linux arm64
630 needs: [preflight, relay_public_config, build_bundle]
631 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
632 uses: ./.github/workflows/release-desktop.yml
633 secrets: inherit
634 with:
635 version: ${{ needs.preflight.outputs.version }}
636 ref: ${{ needs.preflight.outputs.ref }}
637 release_channel: ${{ needs.preflight.outputs.release_channel }}
638 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
639 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
640 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
641 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
642 label: Linux arm64
643 runner: blacksmith-16vcpu-ubuntu-2404-arm
644 platform: linux
645 target: AppImage
646 arch: arm64
647 rust_target: aarch64-unknown-linux-gnu
648 resource_key: linux-arm64
649 cli_archive: true
650
651 # The Windows jobs start with the other platforms. Their checkout, install,
652 # and toolchain setup take longer than the same-arch Linux job needs to
653 # upload its CLI archive, so the wait inside is usually instant.
654 desktop_win_x64:
655 name: Desktop Windows x64
656 needs: [preflight, relay_public_config, build_bundle]
657 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
658 uses: ./.github/workflows/release-desktop.yml
659 secrets: inherit
660 with:
661 version: ${{ needs.preflight.outputs.version }}
662 ref: ${{ needs.preflight.outputs.ref }}
663 release_channel: ${{ needs.preflight.outputs.release_channel }}
664 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
665 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
666 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
667 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
668 label: Windows x64
669 runner: blacksmith-32vcpu-windows-2025
670 platform: win
671 target: nsis
672 arch: x64
673 rust_target: x86_64-pc-windows-msvc
674 resource_key: win32-x64
675 cli_archive: true
676
677 desktop_win_arm64:
678 name: Desktop Windows arm64
679 needs: [preflight, relay_public_config, build_bundle]
680 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
681 uses: ./.github/workflows/release-desktop.yml
682 secrets: inherit
683 with:
684 version: ${{ needs.preflight.outputs.version }}
685 ref: ${{ needs.preflight.outputs.ref }}
686 release_channel: ${{ needs.preflight.outputs.release_channel }}
687 clerk_publishable_key: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
688 clerk_jwt_template: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
689 clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
690 relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
691 label: Windows arm64
692 runner: windows-11-arm
693 platform: win
694 target: nsis
695 arch: arm64
696 rust_target: aarch64-pc-windows-msvc
697 resource_key: win32-arm64
698 cli_archive: true
699
700 release:
701 name: Publish GitHub Release
702 needs:
703 [
704 preflight,
705 relay_public_config,
706 quality,
707 test,
708 test_server,
709 desktop_mac_arm64,
710 desktop_mac_x64,
711 desktop_linux_x64,
712 desktop_linux_arm64,
713 desktop_win_x64,
714 desktop_win_arm64,
715 ]
716 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' }}
717 runs-on: blacksmith-8vcpu-ubuntu-2404
718 timeout-minutes: 30
719 permissions:
720 contents: write
721 steps:
722 - name: Checkout
723 uses: actions/checkout@v6
724 with:
725 ref: ${{ needs.preflight.outputs.ref }}
726 sparse-checkout: |
727 /*
728 !/.repos/
729 sparse-checkout-cone-mode: false
730
731 - name: Setup Vite+
732 uses: voidzero-dev/setup-vp@v1
733 with:
734 node-version-file: package.json
735 cache: true
736 run-install: |
737 args:
738 - --filter=@t3tools/scripts...
739
740 - name: Download all desktop artifacts
741 uses: actions/download-artifact@v8
742 with:
743 pattern: desktop-*
744 merge-multiple: true
745 path: release-assets
746
747 - name: Download all CLI archives
748 uses: actions/download-artifact@v8
749 with:
750 pattern: cli-*
751 merge-multiple: true
752 path: release-assets
753
754 - name: Download internal Android APK for Nightly
755 if: needs.preflight.outputs.release_channel == 'nightly'
756 continue-on-error: true
757 env:
758 GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
759 PACKAGE_NAME: com.t3tools.t3code
760 APK_OUTPUT_DIR: release-assets
761 run: |
762 if [ -n "$GOOGLE_PLAY_SERVICE_ACCOUNT_JSON" ]; then
763 node .github/scripts/mirror-play-apk.cjs
764 fi
765
766 # Installers verify archives against this file, so it is written from the
767 # signed bytes that get uploaded, never from an earlier stage.
768 - name: Write CLI archive checksums
769 shell: bash
770 run: |
771 set -euo pipefail
772 cd release-assets
773 shopt -s nullglob
774 archives=(t3-*.tar.gz t3-*.zip)
775 if [[ ${#archives[@]} -eq 0 ]]; then
776 echo "No CLI archives were produced." >&2
777 exit 1
778 fi
779 sha256sum "${archives[@]}" > SHA256SUMS
780 cat SHA256SUMS
781
782 # The desktop build omits the publish config for preview versions, so
783 # electron-builder emits no updater manifests for them. Refuse to publish
784 # if one shows up anyway: a `latest*.yml` or `nightly*.yml` on a preview
785 # release is what would let a stable or nightly install update onto it.
786 - name: Refuse updater metadata on preview releases
787 if: needs.preflight.outputs.release_channel == 'preview'
788 shell: bash
789 run: |
790 set -euo pipefail
791 shopt -s nullglob extglob
792 # builder-debug.yml is electron-builder's config dump, not a feed.
793 updater_files=(release-assets/!(builder-debug).yml release-assets/*.blockmap)
794 if [[ ${#updater_files[@]} -ne 0 ]]; then
795 printf 'Preview releases must not carry updater metadata, found: %s\n' "${updater_files[*]}" >&2
796 exit 1
797 fi
798
799 # electron-updater reads one manifest per platform and channel and picks
800 # the file entry whose name carries the running arch, so the per-arch
801 # manifests the build jobs wrote are merged back into that one file.
802 - name: Merge macOS updater manifests
803 if: needs.preflight.outputs.release_channel != 'preview'
804 run: |
805 shopt -s nullglob
806 for x64_manifest in release-assets/*-mac-x64.yml; do
807 arm64_manifest="${x64_manifest%-x64.yml}.yml"
808 if [[ -f "$arm64_manifest" ]]; then
809 node scripts/merge-update-manifests.ts --platform mac "$arm64_manifest" "$x64_manifest"
810 rm -f "$x64_manifest"
811 fi
812 done
813
814 - name: Merge Windows updater manifests
815 if: needs.preflight.outputs.release_channel != 'preview'
816 run: |
817 shopt -s nullglob
818 for x64_manifest in release-assets/*-win-x64.yml; do
819 arm64_manifest="${x64_manifest%-x64.yml}-arm64.yml"
820 merged_manifest="${x64_manifest%-win-x64.yml}.yml"
821 if [[ -f "$arm64_manifest" ]]; then
822 node scripts/merge-update-manifests.ts --platform win "$x64_manifest" "$arm64_manifest" "$merged_manifest"
823 rm -f "$x64_manifest" "$arm64_manifest"
824 else
825 mv "$x64_manifest" "$merged_manifest"
826 fi
827 done
828
829 # Updater manifests and blockmaps are what electron-updater consumes.
830 # They are only listed for channels an updater is meant to follow.
831 - id: release_files
832 name: Resolve release asset list
833 shell: bash
834 run: |
835 {
836 echo 'files<<EOF'
837 echo 'release-assets/*.dmg'
838 echo 'release-assets/*.zip'
839 echo 'release-assets/*.AppImage'
840 echo 'release-assets/*.deb'
841 echo 'release-assets/*.exe'
842 if [[ "${{ needs.preflight.outputs.release_channel }}" != "preview" ]]; then
843 echo 'release-assets/*.blockmap'
844 echo 'release-assets/*.yml'
845 fi
846 echo 'release-assets/*.tar.gz'
847 # Only list APKs when Play has a processed internal build available.
848 for apk in release-assets/*.apk; do
849 [[ -f "$apk" ]] && echo "$apk"
850 done
851 echo 'release-assets/SHA256SUMS'
852 echo 'EOF'
853 } >> "$GITHUB_OUTPUT"
854
855 # A preview release gets a warning instead of generated notes. Generated
856 # notes would list every commit since the previous preview, which is
857 # unmerged branch history no one should read as a changelog, and would
858 # make the release look like any other build to someone browsing the
859 # releases page.
860 - name: Write preview release notes
861 if: needs.preflight.outputs.release_channel == 'preview'
862 shell: bash
863 run: |
864 cat > release-notes.md <<'EOF'
865 > [!WARNING]
866 > **This is a preview build. Do not install it unless you know exactly why you are here.**
867 >
868 > 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.
869
870 Built from `${{ needs.preflight.outputs.ref }}`.
871 EOF
872
873 - name: Publish release
874 if: needs.preflight.outputs.previous_tag != ''
875 uses: softprops/action-gh-release@v3
876 with:
877 tag_name: ${{ needs.preflight.outputs.tag }}
878 target_commitish: ${{ needs.preflight.outputs.ref }}
879 name: ${{ needs.preflight.outputs.release_name }}
880 generate_release_notes: ${{ needs.preflight.outputs.release_channel != 'preview' }}
881 body_path: ${{ needs.preflight.outputs.release_channel == 'preview' && 'release-notes.md' || '' }}
882 previous_tag: ${{ needs.preflight.outputs.previous_tag }}
883 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
884 make_latest: ${{ needs.preflight.outputs.make_latest }}
885 files: ${{ steps.release_files.outputs.files }}
886 fail_on_unmatched_files: true
887 token: ${{ github.token }}
888
889 - name: Publish first release
890 if: needs.preflight.outputs.previous_tag == ''
891 uses: softprops/action-gh-release@v3
892 with:
893 tag_name: ${{ needs.preflight.outputs.tag }}
894 target_commitish: ${{ needs.preflight.outputs.ref }}
895 name: ${{ needs.preflight.outputs.release_name }}
896 generate_release_notes: ${{ needs.preflight.outputs.release_channel != 'preview' }}
897 body_path: ${{ needs.preflight.outputs.release_channel == 'preview' && 'release-notes.md' || '' }}
898 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
899 make_latest: ${{ needs.preflight.outputs.make_latest }}
900 files: ${{ steps.release_files.outputs.files }}
901 fail_on_unmatched_files: true
902 token: ${{ github.token }}
903
904 # The `t3` npm package is a launcher that downloads this version's CLI
905 # archive from the GitHub Release, so it publishes only once that release
906 # exists. Preview publishes too, under the `preview` dist-tag, which
907 # nothing resolves unless asked for by name.
908 publish_cli:
909 name: Publish CLI to npm
910 needs: [preflight, release]
911 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
912 runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
913 timeout-minutes: 15
914 permissions:
915 contents: read
916 id-token: write
917 steps:
918 - name: Checkout
919 uses: actions/checkout@v6
920 with:
921 ref: ${{ needs.preflight.outputs.ref }}
922 sparse-checkout: |
923 /*
924 !/.repos/
925 sparse-checkout-cone-mode: false
926
927 - name: Setup Vite+
928 uses: voidzero-dev/setup-vp@v1
929 with:
930 node-version-file: package.json
931 cache: true
932 run-install: |
933 args:
934 - --filter=t3...
935 - --filter=@t3tools/scripts...
936
937 - name: Build the npm launcher
938 run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
939
940 - name: Publish the npm launcher
941 run: |
942 if ! node apps/server/scripts/cli.ts publish --packages-dir npm-packages --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --provenance --verbose; then
943 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
944 exit 1
945 fi
946
947 publish_aur:
948 name: Publish AUR package
949 needs: [preflight, release]
950 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
951 uses: ./.github/workflows/publish-aur.yml
952 with:
953 release_tag: ${{ needs.preflight.outputs.tag }}
954 secrets:
955 AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
956
957 # Vercel builds the hosted web app while the desktop jobs run. `--skip-domain`
958 # keeps the custom domains (the channel and router domains) on the previous
959 # deployment until deploy_web aliases them, after the GitHub Release. It does
960 # still move the project's own *.vercel.app production hostname at build time.
961 # That hostname sits behind Vercel SSO and is not a user channel, so the
962 # npm-before-client order in docs/operations/release.md holds for users.
963 build_web:
964 name: Build hosted web app
965 needs: [preflight, relay_public_config]
966 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
967 runs-on: blacksmith-8vcpu-ubuntu-2404
968 timeout-minutes: 10
969 outputs:
970 deployment_url: ${{ steps.deploy.outputs.deployment_url }}
971 env:
972 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
973 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
974 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
975 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
976 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
977 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
978 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
979 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
980 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
981 steps:
982 - name: Checkout
983 uses: actions/checkout@v6
984 with:
985 ref: ${{ needs.preflight.outputs.ref }}
986 sparse-checkout: |
987 /*
988 !/.repos/
989 sparse-checkout-cone-mode: false
990
991 - name: Setup Vite+
992 uses: voidzero-dev/setup-vp@v1
993 with:
994 node-version-file: package.json
995 cache: true
996 run-install: |
997 args:
998 - --filter=@t3tools/scripts...
999 - --filter=@t3tools/web...
1000
1001 - name: Download relay client tracing config
1002 uses: actions/download-artifact@v8
1003 with:
1004 name: relay-client-tracing-config
1005 path: ${{ runner.temp }}/relay-client-tracing
1006
1007 - name: Load relay client tracing config
1008 shell: bash
1009 run: |
1010 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
1011 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
1012 echo "::add-mask::$tracing_token"
1013 cat "$config_path" >> "$GITHUB_ENV"
1014
1015 - name: Align package versions to release version
1016 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
1017
1018 - name: Refresh release lockfile
1019 run: vp install --lockfile-only --ignore-scripts
1020
1021 - id: deploy
1022 name: Build staged deployment
1023 shell: bash
1024 run: |
1025 set -euo pipefail
1026
1027 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" || -z "${VERCEL_PROJECT_ID:-}" ]]; then
1028 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID." >&2
1029 exit 1
1030 fi
1031
1032 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
1033 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
1034 channel_name="latest"
1035 else
1036 channel_name="nightly"
1037 fi
1038
1039 echo "Building hosted web app for $channel_name channel."
1040 deployment_url="$(
1041 vp dlx vercel@53.1.1 deploy \
1042 --archive=tgz \
1043 --prod \
1044 --skip-domain \
1045 --yes \
1046 --token "$VERCEL_TOKEN" \
1047 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}" \
1048 --build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
1049 --build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
1050 --build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
1051 --build-env "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID=${T3CODE_CLERK_CLI_OAUTH_CLIENT_ID:-}" \
1052 --build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
1053 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=${T3CODE_RELAY_CLIENT_OTLP_TRACES_URL:-}" \
1054 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=${T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET:-}" \
1055 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=${T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN:-}" \
1056 --build-env "VITE_HOSTED_APP_URL=$router_url" \
1057 --build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
1058 )"
1059 echo "Staged $deployment_url."
1060 echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"
1061
1062 deploy_web:
1063 name: Deploy hosted web app
1064 needs: [preflight, build_web, release, publish_cli]
1065 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' }}
1066 runs-on: blacksmith-2vcpu-ubuntu-2404
1067 timeout-minutes: 10
1068 env:
1069 DEPLOYMENT_URL: ${{ needs.build_web.outputs.deployment_url }}
1070 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1071 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1072 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1073 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
1074 T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
1075 T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
1076 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1077 steps:
1078 - name: Checkout
1079 uses: actions/checkout@v6
1080 with:
1081 ref: ${{ needs.preflight.outputs.ref }}
1082 sparse-checkout: |
1083 /*
1084 !/.repos/
1085 sparse-checkout-cone-mode: false
1086
1087 - name: Setup Vite+
1088 uses: voidzero-dev/setup-vp@v1
1089 with:
1090 node-version-file: package.json
1091 cache: false
1092 run-install: false
1093
1094 - name: Alias channel
1095 shell: bash
1096 run: |
1097 set -euo pipefail
1098
1099 if [[ -z "$DEPLOYMENT_URL" ]]; then
1100 echo "Build hosted web app did not report a deployment URL." >&2
1101 exit 1
1102 fi
1103
1104 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
1105 latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
1106 nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
1107 router_domain="${router_url#http://}"
1108 router_domain="${router_domain#https://}"
1109 router_domain="${router_domain%%/*}"
1110
1111 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
1112 channel_domain="$latest_domain"
1113 channel_name="latest"
1114 else
1115 channel_domain="$nightly_domain"
1116 channel_name="nightly"
1117 fi
1118
1119 vercel_scope_args=(--scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}")
1120
1121 echo "Aliasing $DEPLOYMENT_URL to $channel_domain."
1122 vp dlx vercel@53.1.1 alias set "$DEPLOYMENT_URL" "$channel_domain" \
1123 --token "$VERCEL_TOKEN" \
1124 "${vercel_scope_args[@]}"
1125
1126 if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
1127 echo "Aliasing $DEPLOYMENT_URL to router domain $router_domain."
1128 vp dlx vercel@53.1.1 alias set "$DEPLOYMENT_URL" "$router_domain" \
1129 --token "$VERCEL_TOKEN" \
1130 "${vercel_scope_args[@]}"
1131 fi
1132
1133 # Same split as the web app: build a production deployment early, then
1134 # promote it to t3.codes once the release it links to exists. As above, the
1135 # project's own *.vercel.app hostname moves at build time.
1136 build_marketing:
1137 name: Build marketing site
1138 needs: [preflight]
1139 if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
1140 runs-on: blacksmith-8vcpu-ubuntu-2404
1141 timeout-minutes: 10
1142 outputs:
1143 deployment_url: ${{ steps.deploy.outputs.deployment_url }}
1144 project_id: ${{ steps.deploy.outputs.project_id }}
1145 env:
1146 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1147 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1148 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1149 steps:
1150 - name: Checkout
1151 uses: actions/checkout@v6
1152 with:
1153 ref: ${{ needs.preflight.outputs.ref }}
1154 sparse-checkout: |
1155 /*
1156 !/.repos/
1157 sparse-checkout-cone-mode: false
1158
1159 - name: Setup Vite+
1160 uses: voidzero-dev/setup-vp@v1
1161 with:
1162 node-version-file: package.json
1163 cache: true
1164 run-install: |
1165 args:
1166 - --filter=@t3tools/marketing...
1167
1168 - id: deploy
1169 name: Build staged deployment
1170 shell: bash
1171 run: |
1172 set -euo pipefail
1173
1174 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" ]]; then
1175 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID." >&2
1176 exit 1
1177 fi
1178
1179 VERCEL_PROJECT_ID="$(
1180 curl --fail --silent --show-error \
1181 --header "Authorization: Bearer $VERCEL_TOKEN" \
1182 "https://api.vercel.com/v9/projects/t3code-marketing?teamId=$VERCEL_ORG_ID" \
1183 | jq --exit-status --raw-output '.id'
1184 )"
1185 export VERCEL_PROJECT_ID
1186
1187 deployment_url="$(
1188 vp dlx vercel@53.1.1 deploy \
1189 --archive=tgz \
1190 --prod \
1191 --skip-domain \
1192 --yes \
1193 --token "$VERCEL_TOKEN" \
1194 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1195 )"
1196 echo "Staged $deployment_url."
1197 echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"
1198 echo "project_id=$VERCEL_PROJECT_ID" >> "$GITHUB_OUTPUT"
1199
1200 deploy_marketing:
1201 name: Deploy marketing site
1202 needs: [preflight, build_marketing, release]
1203 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build_marketing.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
1204 runs-on: blacksmith-2vcpu-ubuntu-2404
1205 timeout-minutes: 10
1206 env:
1207 DEPLOYMENT_URL: ${{ needs.build_marketing.outputs.deployment_url }}
1208 VERCEL_PROJECT_ID: ${{ needs.build_marketing.outputs.project_id }}
1209 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1210 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1211 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1212 steps:
1213 - name: Checkout
1214 uses: actions/checkout@v6
1215 with:
1216 ref: ${{ needs.preflight.outputs.ref }}
1217 sparse-checkout: |
1218 /*
1219 !/.repos/
1220 sparse-checkout-cone-mode: false
1221
1222 - name: Setup Vite+
1223 uses: voidzero-dev/setup-vp@v1
1224 with:
1225 node-version-file: package.json
1226 cache: false
1227 run-install: false
1228
1229 - name: Promote marketing site
1230 shell: bash
1231 run: |
1232 set -euo pipefail
1233
1234 if [[ -z "$DEPLOYMENT_URL" ]]; then
1235 echo "Build marketing site did not report a deployment URL." >&2
1236 exit 1
1237 fi
1238
1239 echo "Promoting $DEPLOYMENT_URL."
1240 vp dlx vercel@53.1.1 promote "$DEPLOYMENT_URL" \
1241 --yes \
1242 --token "$VERCEL_TOKEN" \
1243 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1244
1245 finalize:
1246 name: Finalize release
1247 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
1248 needs: [preflight, release]
1249 runs-on: blacksmith-8vcpu-ubuntu-2404
1250 timeout-minutes: 10
1251 steps:
1252 - id: app_token
1253 name: Mint release app token
1254 uses: actions/create-github-app-token@v2
1255 with:
1256 app-id: ${{ secrets.RELEASE_APP_ID }}
1257 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
1258 owner: ${{ github.repository_owner }}
1259
1260 - name: Checkout
1261 uses: actions/checkout@v6
1262 with:
1263 ref: main
1264 fetch-depth: 0
1265 token: ${{ steps.app_token.outputs.token }}
1266 persist-credentials: true
1267 sparse-checkout: |
1268 /*
1269 !/.repos/
1270 sparse-checkout-cone-mode: false
1271
1272 - id: app_bot
1273 name: Resolve GitHub App bot identity
1274 env:
1275 GH_TOKEN: ${{ steps.app_token.outputs.token }}
1276 APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
1277 run: |
1278 user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
1279 echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
1280 echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
1281
1282 - name: Setup Vite+
1283 uses: voidzero-dev/setup-vp@v1
1284 with:
1285 node-version-file: package.json
1286 cache: true
1287 run-install: |
1288 args:
1289 - --filter=@t3tools/scripts...
1290 - --filter=@t3tools/oxlint-plugin-t3code...
1291
1292 - id: update_versions
1293 name: Update version strings
1294 env:
1295 RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
1296 run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
1297
1298 - name: Format package.json files
1299 if: steps.update_versions.outputs.changed == 'true'
1300 run: vp fmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
1301
1302 - name: Refresh lockfile
1303 if: steps.update_versions.outputs.changed == 'true'
1304 run: vp install --lockfile-only --ignore-scripts
1305
1306 - name: Commit and push version bump
1307 if: steps.update_versions.outputs.changed == 'true'
1308 shell: bash
1309 env:
1310 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
1311 run: |
1312 if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml; then
1313 echo "No version changes to commit."
1314 exit 0
1315 fi
1316
1317 git config user.name "${{ steps.app_bot.outputs.name }}"
1318 git config user.email "${{ steps.app_bot.outputs.email }}"
1319
1320 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
1321 git commit -m "chore(release): prepare $RELEASE_TAG"
1322 git push origin HEAD:main
1323
1324 announce_discord:
1325 name: Announce release on Discord
1326 if: |
1327 always() && !cancelled() &&
1328 needs.preflight.result == 'success' &&
1329 needs.preflight.outputs.release_channel != 'preview' &&
1330 needs.relay_public_config.result == 'success' &&
1331 needs.release.result == 'success' &&
1332 needs.deploy_web.result == 'success' &&
1333 (needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
1334 needs: [preflight, relay_public_config, release, deploy_web, finalize]
1335 runs-on: blacksmith-8vcpu-ubuntu-2404
1336 timeout-minutes: 10
1337 steps:
1338 - name: Checkout
1339 uses: actions/checkout@v6
1340 with:
1341 ref: ${{ needs.preflight.outputs.ref }}
1342 sparse-checkout: |
1343 /*
1344 !/.repos/
1345 sparse-checkout-cone-mode: false
1346
1347 - name: Setup Vite+
1348 uses: voidzero-dev/setup-vp@v1
1349 with:
1350 node-version-file: package.json
1351 cache: true
1352 run-install: |
1353 args:
1354 - --filter=@t3tools/scripts...
1355
1356 - name: Read published release notes
1357 if: needs.preflight.outputs.is_prerelease == 'true'
1358 continue-on-error: true
1359 env:
1360 GH_TOKEN: ${{ github.token }}
1361 GH_REPO: ${{ github.repository }}
1362 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
1363 RELEASE_CHANNEL: ${{ needs.preflight.outputs.release_channel }}
1364 run: |
1365 if [ "$RELEASE_CHANNEL" = 'nightly' ]; then
1366 if ! gh release view "$RELEASE_TAG" --json body --jq '.body // ""' > "$RUNNER_TEMP/discord-release-notes.md"; then
1367 : > "$RUNNER_TEMP/discord-release-notes.md"
1368 echo '::warning::Could not read published release notes; announcing without a changelog.'
1369 fi
1370 else
1371 : > "$RUNNER_TEMP/discord-release-notes.md"
1372 fi
1373
1374 - name: Announce prerelease on Discord
1375 if: needs.preflight.outputs.is_prerelease == 'true'
1376 continue-on-error: true
1377 env:
1378 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_NIGHTLY_ROLE_ID }}
1379 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1380 run: |
1381 node scripts/notify-discord-release.ts prerelease \
1382 --role-id "$DISCORD_MENTION_ROLE_ID" \
1383 --release-name "${{ needs.preflight.outputs.release_name }}" \
1384 --release-version "${{ needs.preflight.outputs.version }}" \
1385 --tag "${{ needs.preflight.outputs.tag }}" \
1386 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}" \
1387 --release-notes-file "$RUNNER_TEMP/discord-release-notes.md"
1388
1389 - name: Announce latest release on Discord
1390 if: needs.preflight.outputs.make_latest == 'true'
1391 continue-on-error: true
1392 env:
1393 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_LATEST_ROLE_ID }}
1394 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1395 run: |
1396 node scripts/notify-discord-release.ts latest \
1397 --role-id "$DISCORD_MENTION_ROLE_ID" \
1398 --release-name "${{ needs.preflight.outputs.release_name }}" \
1399 --release-version "${{ needs.preflight.outputs.version }}" \
1400 --tag "${{ needs.preflight.outputs.tag }}" \
1401 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"