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

release.yml

1,261 lines52.0 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 deploy_web:
952 name: Deploy hosted web app
953 needs: [preflight, relay_public_config, release]
954 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
955 runs-on: blacksmith-8vcpu-ubuntu-2404
956 timeout-minutes: 10
957 env:
958 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
959 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
960 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
961 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
962 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
963 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
964 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
965 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
966 T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
967 T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
968 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
969 steps:
970 - name: Checkout
971 uses: actions/checkout@v6
972 with:
973 ref: ${{ needs.preflight.outputs.ref }}
974 sparse-checkout: |
975 /*
976 !/.repos/
977 sparse-checkout-cone-mode: false
978​
979 - name: Setup Vite+
980 uses: voidzero-dev/setup-vp@v1
981 with:
982 node-version-file: package.json
983 cache: true
984 run-install: |
985 args:
986 - --filter=@t3tools/scripts...
987 - --filter=@t3tools/web...
988​
989 - name: Download relay client tracing config
990 uses: actions/download-artifact@v8
991 with:
992 name: relay-client-tracing-config
993 path: ${{ runner.temp }}/relay-client-tracing
994​
995 - name: Load relay client tracing config
996 shell: bash
997 run: |
998 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
999 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
1000 echo "::add-mask::$tracing_token"
1001 cat "$config_path" >> "$GITHUB_ENV"
1002​
1003 - name: Align package versions to release version
1004 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
1005​
1006 - name: Refresh release lockfile
1007 run: vp install --lockfile-only --ignore-scripts
1008​
1009 - name: Deploy and alias channel
1010 shell: bash
1011 run: |
1012 set -euo pipefail
1013​
1014 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" || -z "${VERCEL_PROJECT_ID:-}" ]]; then
1015 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID." >&2
1016 exit 1
1017 fi
1018​
1019 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
1020 latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
1021 nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
1022 router_domain="${router_url#http://}"
1023 router_domain="${router_domain#https://}"
1024 router_domain="${router_domain%%/*}"
1025​
1026 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
1027 channel_domain="$latest_domain"
1028 channel_name="latest"
1029 else
1030 channel_domain="$nightly_domain"
1031 channel_name="nightly"
1032 fi
1033​
1034 vercel_scope="${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1035 vercel_scope_args=(--scope "$vercel_scope")
1036​
1037 echo "Deploying hosted web app for $channel_name channel."
1038 deployment_url="$(
1039 vp dlx vercel@53.1.1 deploy \
1040 --archive=tgz \
1041 --prod \
1042 --skip-domain \
1043 --yes \
1044 --token "$VERCEL_TOKEN" \
1045 "${vercel_scope_args[@]}" \
1046 --build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
1047 --build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
1048 --build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
1049 --build-env "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID=${T3CODE_CLERK_CLI_OAUTH_CLIENT_ID:-}" \
1050 --build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
1051 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=${T3CODE_RELAY_CLIENT_OTLP_TRACES_URL:-}" \
1052 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=${T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET:-}" \
1053 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=${T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN:-}" \
1054 --build-env "VITE_HOSTED_APP_URL=$router_url" \
1055 --build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
1056 )"
1057​
1058 echo "Aliasing $deployment_url to $channel_domain."
1059 vp dlx vercel@53.1.1 alias set "$deployment_url" "$channel_domain" \
1060 --token "$VERCEL_TOKEN" \
1061 "${vercel_scope_args[@]}"
1062​
1063 if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
1064 echo "Aliasing $deployment_url to router domain $router_domain."
1065 vp dlx vercel@53.1.1 alias set "$deployment_url" "$router_domain" \
1066 --token "$VERCEL_TOKEN" \
1067 "${vercel_scope_args[@]}"
1068 fi
1069​
1070 deploy_marketing:
1071 name: Deploy marketing site
1072 needs: [preflight, release]
1073 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
1074 runs-on: blacksmith-8vcpu-ubuntu-2404
1075 timeout-minutes: 10
1076 env:
1077 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1078 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1079 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1080 steps:
1081 - name: Checkout
1082 uses: actions/checkout@v6
1083 with:
1084 ref: ${{ needs.preflight.outputs.ref }}
1085 sparse-checkout: |
1086 /*
1087 !/.repos/
1088 sparse-checkout-cone-mode: false
1089​
1090 - name: Setup Vite+
1091 uses: voidzero-dev/setup-vp@v1
1092 with:
1093 node-version-file: package.json
1094 cache: true
1095 run-install: |
1096 args:
1097 - --filter=@t3tools/marketing...
1098​
1099 - name: Deploy marketing site to Vercel
1100 shell: bash
1101 run: |
1102 set -euo pipefail
1103​
1104 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" ]]; then
1105 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID." >&2
1106 exit 1
1107 fi
1108​
1109 VERCEL_PROJECT_ID="$(
1110 curl --fail --silent --show-error \
1111 --header "Authorization: Bearer $VERCEL_TOKEN" \
1112 "https://api.vercel.com/v9/projects/t3code-marketing?teamId=$VERCEL_ORG_ID" \
1113 | jq --exit-status --raw-output '.id'
1114 )"
1115 export VERCEL_PROJECT_ID
1116​
1117 vp dlx vercel@53.1.1 deploy \
1118 --archive=tgz \
1119 --prod \
1120 --yes \
1121 --token "$VERCEL_TOKEN" \
1122 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1123​
1124 finalize:
1125 name: Finalize release
1126 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
1127 needs: [preflight, release]
1128 runs-on: blacksmith-8vcpu-ubuntu-2404
1129 timeout-minutes: 10
1130 steps:
1131 - id: app_token
1132 name: Mint release app token
1133 uses: actions/create-github-app-token@v2
1134 with:
1135 app-id: ${{ secrets.RELEASE_APP_ID }}
1136 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
1137 owner: ${{ github.repository_owner }}
1138​
1139 - name: Checkout
1140 uses: actions/checkout@v6
1141 with:
1142 ref: main
1143 fetch-depth: 0
1144 token: ${{ steps.app_token.outputs.token }}
1145 persist-credentials: true
1146 sparse-checkout: |
1147 /*
1148 !/.repos/
1149 sparse-checkout-cone-mode: false
1150​
1151 - id: app_bot
1152 name: Resolve GitHub App bot identity
1153 env:
1154 GH_TOKEN: ${{ steps.app_token.outputs.token }}
1155 APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
1156 run: |
1157 user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
1158 echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
1159 echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
1160​
1161 - name: Setup Vite+
1162 uses: voidzero-dev/setup-vp@v1
1163 with:
1164 node-version-file: package.json
1165 cache: true
1166 run-install: |
1167 args:
1168 - --filter=@t3tools/scripts...
1169 - --filter=@t3tools/oxlint-plugin-t3code...
1170​
1171 - id: update_versions
1172 name: Update version strings
1173 env:
1174 RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
1175 run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
1176​
1177 - name: Format package.json files
1178 if: steps.update_versions.outputs.changed == 'true'
1179 run: vp fmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
1180​
1181 - name: Refresh lockfile
1182 if: steps.update_versions.outputs.changed == 'true'
1183 run: vp install --lockfile-only --ignore-scripts
1184​
1185 - name: Commit and push version bump
1186 if: steps.update_versions.outputs.changed == 'true'
1187 shell: bash
1188 env:
1189 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
1190 run: |
1191 if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml; then
1192 echo "No version changes to commit."
1193 exit 0
1194 fi
1195​
1196 git config user.name "${{ steps.app_bot.outputs.name }}"
1197 git config user.email "${{ steps.app_bot.outputs.email }}"
1198​
1199 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
1200 git commit -m "chore(release): prepare $RELEASE_TAG"
1201 git push origin HEAD:main
1202​
1203 announce_discord:
1204 name: Announce release on Discord
1205 if: |
1206 always() && !cancelled() &&
1207 needs.preflight.result == 'success' &&
1208 needs.preflight.outputs.release_channel != 'preview' &&
1209 needs.relay_public_config.result == 'success' &&
1210 needs.release.result == 'success' &&
1211 needs.deploy_web.result == 'success' &&
1212 (needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
1213 needs: [preflight, relay_public_config, release, deploy_web, finalize]
1214 runs-on: blacksmith-8vcpu-ubuntu-2404
1215 timeout-minutes: 10
1216 steps:
1217 - name: Checkout
1218 uses: actions/checkout@v6
1219 with:
1220 ref: ${{ needs.preflight.outputs.ref }}
1221 sparse-checkout: |
1222 /*
1223 !/.repos/
1224 sparse-checkout-cone-mode: false
1225​
1226 - name: Setup Vite+
1227 uses: voidzero-dev/setup-vp@v1
1228 with:
1229 node-version-file: package.json
1230 cache: true
1231 run-install: |
1232 args:
1233 - --filter=@t3tools/scripts...
1234​
1235 - name: Announce prerelease on Discord
1236 if: needs.preflight.outputs.is_prerelease == 'true'
1237 continue-on-error: true
1238 env:
1239 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_NIGHTLY_ROLE_ID }}
1240 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1241 run: |
1242 node scripts/notify-discord-release.ts prerelease \
1243 --role-id "$DISCORD_MENTION_ROLE_ID" \
1244 --release-name "${{ needs.preflight.outputs.release_name }}" \
1245 --release-version "${{ needs.preflight.outputs.version }}" \
1246 --tag "${{ needs.preflight.outputs.tag }}" \
1247 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"
1248​
1249 - name: Announce latest release on Discord
1250 if: needs.preflight.outputs.make_latest == 'true'
1251 continue-on-error: true
1252 env:
1253 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_LATEST_ROLE_ID }}
1254 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1255 run: |
1256 node scripts/notify-discord-release.ts latest \
1257 --role-id "$DISCORD_MENTION_ROLE_ID" \
1258 --release-name "${{ needs.preflight.outputs.release_name }}" \
1259 --release-version "${{ needs.preflight.outputs.version }}" \
1260 --tag "${{ needs.preflight.outputs.tag }}" \
1261 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"