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

release.yml

1,393 lines56.9 KB

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