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

release.yml

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