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

release.yml

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