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

release.yml

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