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

release.yml

1,386 lines57.1 KB

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