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