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

release.yml

1,402 lines57.5 KB

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