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

release.yml

1,258 lines51.9 KB

1name: Release
2​
3on:
4 push:
5 tags:
6 - "v*.*.*"
7 - "!v*-nightly.*"
8 - "!v*-preview.*"
9 schedule:
10 # Avoid minute zero, when GitHub scheduled jobs are busiest.
11 - cron: "8,38 * * * *"
12 workflow_dispatch:
13 inputs:
14 channel:
15 description: "Release channel"
16 required: false
17 default: preview
18 type: choice
19 options:
20 - preview
21 - stable
22 - nightly
23 version:
24 description: "Stable version override (for example 1.2.3). Defaults to the version the latest nightly previewed."
25 required: false
26 type: string
27​
28# Serialize nightlies (scheduled and manual) so overlapping runs cannot build
29# the same commit twice or publish out of order. Stable tag releases get their
30# own group so a nightly never blocks them. Running publishers are never
31# canceled, and queue: max keeps every pending run instead of the default
32# newest-wins single slot, so a queued stable tag can never be silently
33# dropped. Automatic nightlies recheck the release gap after leaving the queue.
34concurrency:
35 group: release-${{ (github.event_name == 'schedule' || inputs.channel == 'nightly' || inputs.channel == 'preview') && 'nightly' || 'stable' }}
36 cancel-in-progress: false
37 queue: max
38​
39permissions:
40 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: blacksmith-16vcpu-ubuntu-2404-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/*.deb'
879 echo 'release-assets/*.exe'
880 if [[ "${{ needs.preflight.outputs.release_channel }}" != "preview" ]]; then
881 echo 'release-assets/*.blockmap'
882 echo 'release-assets/*.yml'
883 fi
884 echo 'release-assets/*.tar.gz'
885 echo 'release-assets/SHA256SUMS'
886 echo 'EOF'
887 } >> "$GITHUB_OUTPUT"
888​
889 # A preview release gets a warning instead of generated notes. Generated
890 # notes would list every commit since the previous preview, which is
891 # unmerged branch history no one should read as a changelog, and would
892 # make the release look like any other build to someone browsing the
893 # releases page.
894 - name: Write preview release notes
895 if: needs.preflight.outputs.release_channel == 'preview'
896 shell: bash
897 run: |
898 cat > release-notes.md <<'EOF'
899 > [!WARNING]
900 > **This is a preview build. Do not install it unless you know exactly why you are here.**
901 >
902 > 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.
903​
904 Built from `${{ needs.preflight.outputs.ref }}`.
905 EOF
906​
907 - name: Publish release
908 if: needs.preflight.outputs.previous_tag != ''
909 uses: softprops/action-gh-release@v3
910 with:
911 tag_name: ${{ needs.preflight.outputs.tag }}
912 target_commitish: ${{ needs.preflight.outputs.ref }}
913 name: ${{ needs.preflight.outputs.release_name }}
914 generate_release_notes: ${{ needs.preflight.outputs.release_channel != 'preview' }}
915 body_path: ${{ needs.preflight.outputs.release_channel == 'preview' && 'release-notes.md' || '' }}
916 previous_tag: ${{ needs.preflight.outputs.previous_tag }}
917 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
918 make_latest: ${{ needs.preflight.outputs.make_latest }}
919 files: ${{ steps.release_files.outputs.files }}
920 fail_on_unmatched_files: true
921 token: ${{ github.token }}
922​
923 - name: Publish first release
924 if: needs.preflight.outputs.previous_tag == ''
925 uses: softprops/action-gh-release@v3
926 with:
927 tag_name: ${{ needs.preflight.outputs.tag }}
928 target_commitish: ${{ needs.preflight.outputs.ref }}
929 name: ${{ needs.preflight.outputs.release_name }}
930 generate_release_notes: ${{ needs.preflight.outputs.release_channel != 'preview' }}
931 body_path: ${{ needs.preflight.outputs.release_channel == 'preview' && 'release-notes.md' || '' }}
932 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
933 make_latest: ${{ needs.preflight.outputs.make_latest }}
934 files: ${{ steps.release_files.outputs.files }}
935 fail_on_unmatched_files: true
936 token: ${{ github.token }}
937​
938 publish_aur:
939 name: Publish AUR package
940 needs: [preflight, release]
941 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
942 uses: ./.github/workflows/publish-aur.yml
943 with:
944 release_tag: ${{ needs.preflight.outputs.tag }}
945 secrets:
946 AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
947​
948 deploy_web:
949 name: Deploy hosted web app
950 needs: [preflight, relay_public_config, release]
951 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
952 runs-on: blacksmith-8vcpu-ubuntu-2404
953 timeout-minutes: 10
954 env:
955 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
956 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
957 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
958 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
959 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
960 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
961 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
962 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
963 T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
964 T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
965 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
966 steps:
967 - name: Checkout
968 uses: actions/checkout@v6
969 with:
970 ref: ${{ needs.preflight.outputs.ref }}
971 sparse-checkout: |
972 /*
973 !/.repos/
974 sparse-checkout-cone-mode: false
975​
976 - name: Setup Vite+
977 uses: voidzero-dev/setup-vp@v1
978 with:
979 node-version-file: package.json
980 cache: true
981 run-install: |
982 args:
983 - --filter=@t3tools/scripts...
984 - --filter=@t3tools/web...
985​
986 - name: Download relay client tracing config
987 uses: actions/download-artifact@v8
988 with:
989 name: relay-client-tracing-config
990 path: ${{ runner.temp }}/relay-client-tracing
991​
992 - name: Load relay client tracing config
993 shell: bash
994 run: |
995 config_path="$RUNNER_TEMP/relay-client-tracing/relay-client-tracing.env"
996 tracing_token="$(sed -n 's/^T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=//p' "$config_path")"
997 echo "::add-mask::$tracing_token"
998 cat "$config_path" >> "$GITHUB_ENV"
999​
1000 - name: Align package versions to release version
1001 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
1002​
1003 - name: Refresh release lockfile
1004 run: vp install --lockfile-only --ignore-scripts
1005​
1006 - name: Deploy and alias channel
1007 shell: bash
1008 run: |
1009 set -euo pipefail
1010​
1011 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" || -z "${VERCEL_PROJECT_ID:-}" ]]; then
1012 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID." >&2
1013 exit 1
1014 fi
1015​
1016 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
1017 latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
1018 nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
1019 router_domain="${router_url#http://}"
1020 router_domain="${router_domain#https://}"
1021 router_domain="${router_domain%%/*}"
1022​
1023 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
1024 channel_domain="$latest_domain"
1025 channel_name="latest"
1026 else
1027 channel_domain="$nightly_domain"
1028 channel_name="nightly"
1029 fi
1030​
1031 vercel_scope="${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1032 vercel_scope_args=(--scope "$vercel_scope")
1033​
1034 echo "Deploying hosted web app for $channel_name channel."
1035 deployment_url="$(
1036 vp dlx vercel@53.1.1 deploy \
1037 --archive=tgz \
1038 --prod \
1039 --skip-domain \
1040 --yes \
1041 --token "$VERCEL_TOKEN" \
1042 "${vercel_scope_args[@]}" \
1043 --build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
1044 --build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
1045 --build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
1046 --build-env "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID=${T3CODE_CLERK_CLI_OAUTH_CLIENT_ID:-}" \
1047 --build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
1048 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=${T3CODE_RELAY_CLIENT_OTLP_TRACES_URL:-}" \
1049 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=${T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET:-}" \
1050 --build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=${T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN:-}" \
1051 --build-env "VITE_HOSTED_APP_URL=$router_url" \
1052 --build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
1053 )"
1054​
1055 echo "Aliasing $deployment_url to $channel_domain."
1056 vp dlx vercel@53.1.1 alias set "$deployment_url" "$channel_domain" \
1057 --token "$VERCEL_TOKEN" \
1058 "${vercel_scope_args[@]}"
1059​
1060 if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
1061 echo "Aliasing $deployment_url to router domain $router_domain."
1062 vp dlx vercel@53.1.1 alias set "$deployment_url" "$router_domain" \
1063 --token "$VERCEL_TOKEN" \
1064 "${vercel_scope_args[@]}"
1065 fi
1066​
1067 deploy_marketing:
1068 name: Deploy marketing site
1069 needs: [preflight, release]
1070 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
1071 runs-on: blacksmith-8vcpu-ubuntu-2404
1072 timeout-minutes: 10
1073 env:
1074 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1075 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1076 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
1077 steps:
1078 - name: Checkout
1079 uses: actions/checkout@v6
1080 with:
1081 ref: ${{ needs.preflight.outputs.ref }}
1082 sparse-checkout: |
1083 /*
1084 !/.repos/
1085 sparse-checkout-cone-mode: false
1086​
1087 - name: Setup Vite+
1088 uses: voidzero-dev/setup-vp@v1
1089 with:
1090 node-version-file: package.json
1091 cache: true
1092 run-install: |
1093 args:
1094 - --filter=@t3tools/marketing...
1095​
1096 - name: Deploy marketing site to Vercel
1097 shell: bash
1098 run: |
1099 set -euo pipefail
1100​
1101 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" ]]; then
1102 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID." >&2
1103 exit 1
1104 fi
1105​
1106 VERCEL_PROJECT_ID="$(
1107 curl --fail --silent --show-error \
1108 --header "Authorization: Bearer $VERCEL_TOKEN" \
1109 "https://api.vercel.com/v9/projects/t3code-marketing?teamId=$VERCEL_ORG_ID" \
1110 | jq --exit-status --raw-output '.id'
1111 )"
1112 export VERCEL_PROJECT_ID
1113​
1114 vp dlx vercel@53.1.1 deploy \
1115 --archive=tgz \
1116 --prod \
1117 --yes \
1118 --token "$VERCEL_TOKEN" \
1119 --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1120​
1121 finalize:
1122 name: Finalize release
1123 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
1124 needs: [preflight, release]
1125 runs-on: blacksmith-8vcpu-ubuntu-2404
1126 timeout-minutes: 10
1127 steps:
1128 - id: app_token
1129 name: Mint release app token
1130 uses: actions/create-github-app-token@v2
1131 with:
1132 app-id: ${{ secrets.RELEASE_APP_ID }}
1133 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
1134 owner: ${{ github.repository_owner }}
1135​
1136 - name: Checkout
1137 uses: actions/checkout@v6
1138 with:
1139 ref: main
1140 fetch-depth: 0
1141 token: ${{ steps.app_token.outputs.token }}
1142 persist-credentials: true
1143 sparse-checkout: |
1144 /*
1145 !/.repos/
1146 sparse-checkout-cone-mode: false
1147​
1148 - id: app_bot
1149 name: Resolve GitHub App bot identity
1150 env:
1151 GH_TOKEN: ${{ steps.app_token.outputs.token }}
1152 APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
1153 run: |
1154 user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
1155 echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
1156 echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
1157​
1158 - name: Setup Vite+
1159 uses: voidzero-dev/setup-vp@v1
1160 with:
1161 node-version-file: package.json
1162 cache: true
1163 run-install: |
1164 args:
1165 - --filter=@t3tools/scripts...
1166 - --filter=@t3tools/oxlint-plugin-t3code...
1167​
1168 - id: update_versions
1169 name: Update version strings
1170 env:
1171 RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
1172 run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
1173​
1174 - name: Format package.json files
1175 if: steps.update_versions.outputs.changed == 'true'
1176 run: vp fmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
1177​
1178 - name: Refresh lockfile
1179 if: steps.update_versions.outputs.changed == 'true'
1180 run: vp install --lockfile-only --ignore-scripts
1181​
1182 - name: Commit and push version bump
1183 if: steps.update_versions.outputs.changed == 'true'
1184 shell: bash
1185 env:
1186 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
1187 run: |
1188 if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml; then
1189 echo "No version changes to commit."
1190 exit 0
1191 fi
1192​
1193 git config user.name "${{ steps.app_bot.outputs.name }}"
1194 git config user.email "${{ steps.app_bot.outputs.email }}"
1195​
1196 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
1197 git commit -m "chore(release): prepare $RELEASE_TAG"
1198 git push origin HEAD:main
1199​
1200 announce_discord:
1201 name: Announce release on Discord
1202 if: |
1203 always() && !cancelled() &&
1204 needs.preflight.result == 'success' &&
1205 needs.preflight.outputs.release_channel != 'preview' &&
1206 needs.relay_public_config.result == 'success' &&
1207 needs.release.result == 'success' &&
1208 needs.deploy_web.result == 'success' &&
1209 (needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
1210 needs: [preflight, relay_public_config, release, deploy_web, finalize]
1211 runs-on: blacksmith-8vcpu-ubuntu-2404
1212 timeout-minutes: 10
1213 steps:
1214 - name: Checkout
1215 uses: actions/checkout@v6
1216 with:
1217 ref: ${{ needs.preflight.outputs.ref }}
1218 sparse-checkout: |
1219 /*
1220 !/.repos/
1221 sparse-checkout-cone-mode: false
1222​
1223 - name: Setup Vite+
1224 uses: voidzero-dev/setup-vp@v1
1225 with:
1226 node-version-file: package.json
1227 cache: true
1228 run-install: |
1229 args:
1230 - --filter=@t3tools/scripts...
1231​
1232 - name: Announce prerelease on Discord
1233 if: needs.preflight.outputs.is_prerelease == 'true'
1234 continue-on-error: true
1235 env:
1236 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_NIGHTLY_ROLE_ID }}
1237 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1238 run: |
1239 node scripts/notify-discord-release.ts prerelease \
1240 --role-id "$DISCORD_MENTION_ROLE_ID" \
1241 --release-name "${{ needs.preflight.outputs.release_name }}" \
1242 --release-version "${{ needs.preflight.outputs.version }}" \
1243 --tag "${{ needs.preflight.outputs.tag }}" \
1244 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"
1245​
1246 - name: Announce latest release on Discord
1247 if: needs.preflight.outputs.make_latest == 'true'
1248 continue-on-error: true
1249 env:
1250 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_LATEST_ROLE_ID }}
1251 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1252 run: |
1253 node scripts/notify-discord-release.ts latest \
1254 --role-id "$DISCORD_MENTION_ROLE_ID" \
1255 --release-name "${{ needs.preflight.outputs.release_name }}" \
1256 --release-version "${{ needs.preflight.outputs.version }}" \
1257 --tag "${{ needs.preflight.outputs.tag }}" \
1258 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"