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

release.yml

863 lines33.2 KB

1name: Release
2​
3on:
4 push:
5 tags:
6 - "v*.*.*"
7 - "!v*-nightly.*"
8 schedule:
9 - cron: "0 */3 * * *"
10 workflow_dispatch:
11 inputs:
12 channel:
13 description: "Release channel"
14 required: false
15 default: stable
16 type: choice
17 options:
18 - stable
19 - nightly
20 version:
21 description: "Release version (for example 1.2.3 or v1.2.3)"
22 required: false
23 type: string
24​
25permissions:
26 contents: read
27 id-token: none
28​
29jobs:
30 check_changes:
31 name: Check for changes since last nightly
32 if: github.event_name == 'schedule'
33 runs-on: blacksmith-8vcpu-ubuntu-2404
34 outputs:
35 has_changes: ${{ steps.check.outputs.has_changes }}
36 steps:
37 - name: Checkout
38 uses: actions/checkout@v6
39 with:
40 fetch-depth: 0
41​
42 - id: check
43 name: Compare HEAD to last nightly tag
44 run: |
45 last_nightly_tag=$(git tag --list 'v*-nightly.*' 'nightly-v*' --sort=-creatordate | head -n 1)
46 if [[ -z "$last_nightly_tag" ]]; then
47 echo "No previous nightly tag found. Proceeding with release."
48 echo "has_changes=true" >> "$GITHUB_OUTPUT"
49 exit 0
50 fi
51​
52 last_nightly_sha=$(git rev-parse "$last_nightly_tag^{commit}")
53 head_sha=$(git rev-parse HEAD)
54​
55 if [[ "$last_nightly_sha" == "$head_sha" ]]; then
56 echo "No changes on main since last nightly release ($last_nightly_tag). Skipping."
57 echo "has_changes=false" >> "$GITHUB_OUTPUT"
58 else
59 echo "Changes detected on main since $last_nightly_tag ($last_nightly_sha → $head_sha). Proceeding."
60 echo "has_changes=true" >> "$GITHUB_OUTPUT"
61 fi
62​
63 preflight:
64 name: Preflight
65 needs: [check_changes]
66 if: |
67 !failure() && !cancelled() &&
68 (github.event_name != 'schedule' || needs.check_changes.outputs.has_changes == 'true')
69 runs-on: blacksmith-8vcpu-ubuntu-2404
70 timeout-minutes: 10
71 outputs:
72 release_channel: ${{ steps.release_meta.outputs.release_channel }}
73 version: ${{ steps.release_meta.outputs.version }}
74 tag: ${{ steps.release_meta.outputs.tag }}
75 release_name: ${{ steps.release_meta.outputs.name }}
76 short_sha: ${{ steps.release_meta.outputs.short_sha }}
77 previous_tag: ${{ steps.previous_tag.outputs.previous_tag }}
78 cli_dist_tag: ${{ steps.release_meta.outputs.cli_dist_tag }}
79 is_prerelease: ${{ steps.release_meta.outputs.is_prerelease }}
80 make_latest: ${{ steps.release_meta.outputs.make_latest }}
81 ref: ${{ github.sha }}
82 steps:
83 - name: Checkout
84 uses: actions/checkout@v6
85 with:
86 fetch-depth: 0
87​
88 - name: Setup Vite+
89 uses: voidzero-dev/setup-vp@v1
90 with:
91 node-version-file: package.json
92 cache: true
93 run-install: true
94​
95 - name: Ensure Electron runtime is installed
96 run: vp run --filter @t3tools/desktop ensure:electron
97​
98 - id: release_meta
99 name: Resolve release version
100 shell: bash
101 env:
102 DISPATCH_CHANNEL: ${{ github.event.inputs.channel }}
103 DISPATCH_VERSION: ${{ github.event.inputs.version }}
104 NIGHTLY_DATE: ${{ github.run_started_at }}
105 NIGHTLY_SHA: ${{ github.sha }}
106 NIGHTLY_RUN_NUMBER: ${{ github.run_number }}
107 run: |
108 if [[ "${GITHUB_EVENT_NAME}" == "schedule" || ( "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-stable}" == "nightly" ) ]]; then
109 nightly_date="$(date -u -d "$NIGHTLY_DATE" +%Y%m%d)"
110​
111 node scripts/resolve-nightly-release.ts \
112 --date "$nightly_date" \
113 --run-number "$NIGHTLY_RUN_NUMBER" \
114 --sha "$NIGHTLY_SHA" \
115 --github-output
116​
117 echo "release_channel=nightly" >> "$GITHUB_OUTPUT"
118 echo "cli_dist_tag=nightly" >> "$GITHUB_OUTPUT"
119 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
120 echo "make_latest=false" >> "$GITHUB_OUTPUT"
121 else
122 if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
123 raw="${DISPATCH_VERSION}"
124 if [[ -z "$raw" ]]; then
125 echo "workflow_dispatch stable releases require the version input." >&2
126 exit 1
127 fi
128 else
129 raw="${GITHUB_REF_NAME}"
130 fi
131​
132 version="${raw#v}"
133 if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
134 echo "Invalid release version: $raw" >&2
135 exit 1
136 fi
137​
138 echo "release_channel=stable" >> "$GITHUB_OUTPUT"
139 echo "version=$version" >> "$GITHUB_OUTPUT"
140 echo "tag=v$version" >> "$GITHUB_OUTPUT"
141 echo "name=T3 Code v$version" >> "$GITHUB_OUTPUT"
142 echo "cli_dist_tag=latest" >> "$GITHUB_OUTPUT"
143 if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
144 echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
145 echo "make_latest=true" >> "$GITHUB_OUTPUT"
146 else
147 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
148 echo "make_latest=false" >> "$GITHUB_OUTPUT"
149 fi
150 fi
151​
152 - name: Check
153 run: vp check
154​
155 - name: Typecheck
156 run: vp run typecheck
157​
158 - name: Test
159 run: vp run test
160​
161 - id: previous_tag
162 name: Resolve previous release tag
163 run: |
164 node scripts/resolve-previous-release-tag.ts \
165 --channel "${{ steps.release_meta.outputs.release_channel }}" \
166 --current-tag "${{ steps.release_meta.outputs.tag }}" \
167 --github-output
168​
169 relay_public_config:
170 name: Resolve T3 Connect public config
171 needs: preflight
172 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
173 runs-on: blacksmith-8vcpu-ubuntu-2404
174 timeout-minutes: 5
175 environment:
176 name: production
177 outputs:
178 clerk_publishable_key: ${{ steps.public_config.outputs.clerk_publishable_key }}
179 clerk_jwt_template: ${{ steps.public_config.outputs.clerk_jwt_template }}
180 clerk_cli_oauth_client_id: ${{ steps.public_config.outputs.clerk_cli_oauth_client_id }}
181 relay_url: ${{ steps.public_config.outputs.relay_url }}
182 env:
183 RELAY_DOMAIN: ${{ vars.RELAY_DOMAIN }}
184 RELAY_API_ZONE_NAME: ${{ vars.RELAY_API_ZONE_NAME }}
185 CLERK_PUBLISHABLE_KEY: ${{ vars.CLERK_PUBLISHABLE_KEY }}
186 CLERK_JWT_TEMPLATE: ${{ vars.CLERK_JWT_TEMPLATE }}
187 CLERK_CLI_OAUTH_CLIENT_ID: ${{ vars.CLERK_CLI_OAUTH_CLIENT_ID }}
188 steps:
189 - id: public_config
190 name: Resolve production relay public config
191 shell: bash
192 run: |
193 set -euo pipefail
194​
195 relay_domain="${RELAY_DOMAIN:-}"
196 if [[ -z "$relay_domain" && -n "${RELAY_API_ZONE_NAME:-}" ]]; then
197 relay_domain="relay.$RELAY_API_ZONE_NAME"
198 fi
199 required=(
200 relay_domain
201 CLERK_PUBLISHABLE_KEY
202 CLERK_JWT_TEMPLATE
203 CLERK_CLI_OAUTH_CLIENT_ID
204 )
205 missing=()
206 for name in "${required[@]}"; do
207 if [[ -z "${!name:-}" ]]; then
208 missing+=("$name")
209 fi
210 done
211 if (( ${#missing[@]} > 0 )); then
212 printf 'Missing required relay deployment configuration: %s\n' "${missing[*]}" >&2
213 exit 1
214 fi
215​
216 echo "clerk_publishable_key=$CLERK_PUBLISHABLE_KEY" >> "$GITHUB_OUTPUT"
217 echo "clerk_jwt_template=$CLERK_JWT_TEMPLATE" >> "$GITHUB_OUTPUT"
218 echo "clerk_cli_oauth_client_id=$CLERK_CLI_OAUTH_CLIENT_ID" >> "$GITHUB_OUTPUT"
219 echo "relay_url=https://$relay_domain" >> "$GITHUB_OUTPUT"
220​
221 build:
222 name: Build ${{ matrix.label }}
223 needs: [preflight, relay_public_config]
224 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' }}
225 runs-on: ${{ matrix.runner }}
226 timeout-minutes: 30
227 env:
228 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
229 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
230 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
231 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
232 strategy:
233 fail-fast: false
234 matrix:
235 include:
236 - label: macOS arm64
237 runner: blacksmith-12vcpu-macos-26
238 platform: mac
239 target: dmg
240 arch: arm64
241 - label: macOS x64
242 runner: blacksmith-12vcpu-macos-26
243 platform: mac
244 target: dmg
245 arch: x64
246 - label: Linux x64
247 runner: blacksmith-32vcpu-ubuntu-2404
248 platform: linux
249 target: AppImage
250 arch: x64
251 - label: Windows x64
252 runner: blacksmith-32vcpu-windows-2025
253 platform: win
254 target: nsis
255 arch: x64
256 # - label: Windows arm64
257 # runner: windows-11-arm
258 # platform: win
259 # target: nsis
260 # arch: arm64
261 steps:
262 - name: Checkout
263 uses: actions/checkout@v6
264 with:
265 ref: ${{ needs.preflight.outputs.ref }}
266 fetch-depth: 0
267​
268 - name: Setup Vite+
269 uses: voidzero-dev/setup-vp@v1
270 with:
271 node-version-file: package.json
272 cache: true
273 run-install: true
274​
275 - name: Align package versions to release version
276 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
277​
278 - name: Install Spectre-mitigated MSVC libs
279 if: matrix.platform == 'win'
280 shell: pwsh
281 run: |
282 $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
283 $installPath = & $vswhere -products * -latest -property installationPath
284 $setupExe = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe"
285 $proc = Start-Process -FilePath $setupExe `
286 -ArgumentList "modify", "--installPath", "`"$installPath`"", "--add", `
287 "Microsoft.VisualStudio.Component.VC.Tools.x86.x64.Spectre", "--quiet", "--norestart" `
288 -Wait -PassThru -NoNewWindow
289 if ($null -eq $proc -or $proc.ExitCode -ne 0) {
290 $code = if ($null -ne $proc) { $proc.ExitCode } else { 1 }
291 Write-Error "Visual Studio Installer failed with exit code $code"
292 exit $code
293 }
294​
295 - name: Install ImageMagick
296 if: matrix.platform == 'linux'
297 shell: bash
298 run: |
299 if ! command -v magick >/dev/null 2>&1 && ! command -v convert >/dev/null 2>&1; then
300 sudo apt-get update
301 sudo apt-get install -y imagemagick
302 fi
303​
304 if command -v magick >/dev/null 2>&1; then
305 magick -version
306 else
307 convert -version
308 fi
309​
310 - name: Prepare Azure Trusted Signing
311 if: matrix.platform == 'win'
312 shell: pwsh
313 env:
314 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
315 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
316 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
317 AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
318 AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
319 AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
320 AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
321 run: |
322 $ErrorActionPreference = "Stop"
323​
324 $requiredSecrets = @(
325 $env:AZURE_TENANT_ID,
326 $env:AZURE_CLIENT_ID,
327 $env:AZURE_CLIENT_SECRET,
328 $env:AZURE_TRUSTED_SIGNING_ENDPOINT,
329 $env:AZURE_TRUSTED_SIGNING_ACCOUNT_NAME,
330 $env:AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME,
331 $env:AZURE_TRUSTED_SIGNING_PUBLISHER_NAME
332 )
333 if ($requiredSecrets | Where-Object { [string]::IsNullOrWhiteSpace($_) }) {
334 Write-Host "Azure Trusted Signing disabled; skipping TrustedSigning module preparation."
335 exit 0
336 }
337​
338 try {
339 Install-PackageProvider `
340 -Name NuGet `
341 -MinimumVersion 2.8.5.201 `
342 -Force `
343 -Scope CurrentUser `
344 -ErrorAction Stop
345 } catch {
346 Write-Warning "Could not bootstrap NuGet package provider. Continuing because the runner may already have a usable provider. $($_.Exception.Message)"
347 }
348​
349 Install-Module `
350 -Name TrustedSigning `
351 -MinimumVersion 0.5.0 `
352 -Force `
353 -AllowClobber `
354 -Repository PSGallery `
355 -Scope CurrentUser `
356 -ErrorAction Stop
357​
358 Import-Module TrustedSigning -MinimumVersion 0.5.0 -Force
359 Get-Command Invoke-TrustedSigning -ErrorAction Stop
360​
361 $moduleRoots = @(
362 [System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "PowerShell", "Modules"),
363 [System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "WindowsPowerShell", "Modules"),
364 [System.IO.Path]::Combine($env:ProgramFiles, "PowerShell", "Modules"),
365 [System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules")
366 )
367 $modulePathEntries = @($moduleRoots + ($env:PSModulePath -split ";")) |
368 Where-Object { $_ -and (Test-Path $_) } |
369 Select-Object -Unique
370 "PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
371​
372 - name: Build desktop artifact
373 shell: bash
374 env:
375 CSC_LINK: ${{ secrets.CSC_LINK }}
376 CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
377 APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
378 APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
379 APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
380 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
381 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
382 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
383 AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
384 AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
385 AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
386 AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
387 run: |
388 args=(
389 --platform "${{ matrix.platform }}"
390 --target "${{ matrix.target }}"
391 --arch "${{ matrix.arch }}"
392 --build-version "${{ needs.preflight.outputs.version }}"
393 --verbose
394 )
395​
396 has_all() {
397 for value in "$@"; do
398 if [[ -z "$value" ]]; then
399 return 1
400 fi
401 done
402 return 0
403 }
404​
405 if [[ "${{ matrix.platform }}" == "mac" ]]; then
406 if has_all "$CSC_LINK" "$CSC_KEY_PASSWORD" "$APPLE_API_KEY" "$APPLE_API_KEY_ID" "$APPLE_API_ISSUER"; then
407 key_path="$RUNNER_TEMP/AuthKey_${APPLE_API_KEY_ID}.p8"
408 printf '%s' "$APPLE_API_KEY" > "$key_path"
409 export APPLE_API_KEY="$key_path"
410 echo "macOS signing enabled."
411 args+=(--signed)
412 else
413 echo "macOS signing disabled (missing one or more Apple signing secrets)."
414 fi
415 elif [[ "${{ matrix.platform }}" == "win" ]]; then
416 if has_all \
417 "$AZURE_TENANT_ID" \
418 "$AZURE_CLIENT_ID" \
419 "$AZURE_CLIENT_SECRET" \
420 "$AZURE_TRUSTED_SIGNING_ENDPOINT" \
421 "$AZURE_TRUSTED_SIGNING_ACCOUNT_NAME" \
422 "$AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME" \
423 "$AZURE_TRUSTED_SIGNING_PUBLISHER_NAME"; then
424 echo "Windows signing enabled (Azure Trusted Signing)."
425 args+=(--signed)
426 else
427 echo "Windows signing disabled (missing one or more Azure Trusted Signing secrets)."
428 fi
429 else
430 echo "Signing disabled for ${{ matrix.platform }}."
431 fi
432​
433 vp run dist:desktop:artifact "${args[@]}"
434​
435 - name: Collect release assets
436 shell: bash
437 run: |
438 set -euo pipefail
439 mkdir -p release-publish
440​
441 shopt -s nullglob
442 for pattern in \
443 "release/*.dmg" \
444 "release/*.zip" \
445 "release/*.AppImage" \
446 "release/*.exe" \
447 "release/*.blockmap" \
448 "release/*.yml"; do
449 for file in $pattern; do
450 cp "$file" release-publish/
451 done
452 done
453​
454 if [[ "${{ matrix.platform }}" == "mac" && "${{ matrix.arch }}" != "arm64" ]]; then
455 shopt -s nullglob
456 for manifest in release-publish/*-mac.yml; do
457 mv "$manifest" "${manifest%.yml}-${{ matrix.arch }}.yml"
458 done
459 fi
460​
461 # Enable if Windows arm64 builds are enabled.
462 # Windows updater metadata is channel-specific (for example
463 # "latest.yml" or "nightly.yml"). Suffix each per-arch copy so the
464 # release job can merge matching arm64/x64 manifests back into one
465 # canonical manifest per channel.
466 # if [[ "${{ matrix.platform }}" == "win" ]]; then
467 # shopt -s nullglob
468 # for manifest in release-publish/*.yml; do
469 # mv "$manifest" "${manifest%.yml}-win-${{ matrix.arch }}.yml"
470 # done
471 # fi
472​
473 - name: Upload build artifacts
474 uses: actions/upload-artifact@v7
475 with:
476 name: desktop-${{ matrix.platform }}-${{ matrix.arch }}
477 path: release-publish/*
478 if-no-files-found: error
479​
480 publish_cli:
481 name: Publish CLI to npm
482 needs: [preflight, relay_public_config, build]
483 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build.result == 'success' }}
484 runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
485 timeout-minutes: 10
486 permissions:
487 contents: read
488 id-token: write
489 env:
490 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
491 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
492 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
493 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
494 steps:
495 - name: Checkout
496 uses: actions/checkout@v6
497 with:
498 ref: ${{ needs.preflight.outputs.ref }}
499​
500 - name: Setup Vite+
501 uses: voidzero-dev/setup-vp@v1
502 with:
503 node-version-file: package.json
504 cache: true
505 run-install: |
506 args:
507 - --filter=t3...
508 - --filter=@t3tools/web...
509 - --filter=@t3tools/scripts...
510​
511 - name: Align package versions to release version
512 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
513​
514 - name: Build web package
515 run: vp run --filter @t3tools/web build
516​
517 - name: Build CLI package
518 run: vp run --filter t3 build
519​
520 - name: Publish CLI package
521 run: node apps/server/scripts/cli.ts publish --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --app-version "${{ needs.preflight.outputs.version }}" --verbose
522​
523 release:
524 name: Publish GitHub Release
525 needs: [preflight, build, publish_cli]
526 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build.result == 'success' && needs.publish_cli.result == 'success' }}
527 runs-on: blacksmith-8vcpu-ubuntu-2404
528 timeout-minutes: 10
529 steps:
530 - id: app_token
531 name: Mint release app token
532 uses: actions/create-github-app-token@v2
533 with:
534 app-id: ${{ secrets.RELEASE_APP_ID }}
535 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
536 owner: ${{ github.repository_owner }}
537​
538 - name: Checkout
539 uses: actions/checkout@v6
540 with:
541 ref: ${{ needs.preflight.outputs.ref }}
542​
543 - name: Setup Vite+
544 uses: voidzero-dev/setup-vp@v1
545 with:
546 node-version-file: package.json
547 cache: true
548 run-install: |
549 args:
550 - --filter=@t3tools/scripts...
551​
552 - name: Download all desktop artifacts
553 uses: actions/download-artifact@v8
554 with:
555 pattern: desktop-*
556 merge-multiple: true
557 path: release-assets
558​
559 - name: Merge macOS updater manifests
560 run: |
561 shopt -s nullglob
562 for x64_manifest in release-assets/*-mac-x64.yml; do
563 arm64_manifest="${x64_manifest%-x64.yml}.yml"
564 if [[ -f "$arm64_manifest" ]]; then
565 node scripts/merge-update-manifests.ts --platform mac "$arm64_manifest" "$x64_manifest"
566 rm -f "$x64_manifest"
567 fi
568 done
569​
570 # - name: Merge Windows updater manifests
571 # run: |
572 # shopt -s nullglob
573 # found_windows_manifest=false
574 # for x64_manifest in release-assets/*-win-x64.yml; do
575 # if [[ "$(basename "$x64_manifest")" == builder-debug-* ]]; then
576 # continue
577 # fi
578​
579 # arm64_manifest="${x64_manifest/-x64.yml/-arm64.yml}"
580 # output_manifest="${x64_manifest/-win-x64.yml/.yml}"
581 # if [[ ! -f "$arm64_manifest" ]]; then
582 # echo "Missing matching arm64 Windows manifest for $x64_manifest" >&2
583 # exit 1
584 # fi
585​
586 # found_windows_manifest=true
587 # node scripts/merge-update-manifests.ts --platform win \
588 # "$arm64_manifest" \
589 # "$x64_manifest" \
590 # "$output_manifest"
591 # rm -f "$arm64_manifest" "$x64_manifest"
592 # done
593​
594 # if [[ "$found_windows_manifest" != true ]]; then
595 # echo "No Windows updater manifests found to merge." >&2
596 # exit 1
597 # fi
598​
599 - name: Publish release
600 if: needs.preflight.outputs.previous_tag != ''
601 uses: softprops/action-gh-release@v2
602 with:
603 tag_name: ${{ needs.preflight.outputs.tag }}
604 target_commitish: ${{ needs.preflight.outputs.ref }}
605 name: ${{ needs.preflight.outputs.release_name }}
606 generate_release_notes: true
607 previous_tag: ${{ needs.preflight.outputs.previous_tag }}
608 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
609 make_latest: ${{ needs.preflight.outputs.make_latest }}
610 files: |
611 release-assets/*.dmg
612 release-assets/*.zip
613 release-assets/*.AppImage
614 release-assets/*.exe
615 release-assets/*.blockmap
616 release-assets/*.yml
617 fail_on_unmatched_files: true
618 token: ${{ steps.app_token.outputs.token }}
619​
620 - name: Publish first release
621 if: needs.preflight.outputs.previous_tag == ''
622 uses: softprops/action-gh-release@v2
623 with:
624 tag_name: ${{ needs.preflight.outputs.tag }}
625 target_commitish: ${{ needs.preflight.outputs.ref }}
626 name: ${{ needs.preflight.outputs.release_name }}
627 generate_release_notes: true
628 prerelease: ${{ needs.preflight.outputs.is_prerelease }}
629 make_latest: ${{ needs.preflight.outputs.make_latest }}
630 files: |
631 release-assets/*.dmg
632 release-assets/*.zip
633 release-assets/*.AppImage
634 release-assets/*.exe
635 release-assets/*.blockmap
636 release-assets/*.yml
637 fail_on_unmatched_files: true
638 token: ${{ steps.app_token.outputs.token }}
639​
640 deploy_web:
641 name: Deploy hosted web app
642 needs: [preflight, relay_public_config, release]
643 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.release.result == 'success' }}
644 runs-on: blacksmith-8vcpu-ubuntu-2404
645 timeout-minutes: 10
646 env:
647 T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
648 T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
649 T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
650 VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
651 VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
652 VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
653 T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
654 T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
655 T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
656 VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
657 steps:
658 - name: Checkout
659 uses: actions/checkout@v6
660 with:
661 ref: ${{ needs.preflight.outputs.ref }}
662​
663 - name: Setup Vite+
664 uses: voidzero-dev/setup-vp@v1
665 with:
666 node-version-file: package.json
667 cache: true
668 run-install: |
669 args:
670 - --filter=@t3tools/scripts...
671 - --filter=@t3tools/web...
672​
673 - name: Align package versions to release version
674 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
675​
676 - name: Refresh release lockfile
677 run: vp install --lockfile-only --ignore-scripts
678​
679 - name: Deploy and alias channel
680 shell: bash
681 run: |
682 set -euo pipefail
683​
684 if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" || -z "${VERCEL_PROJECT_ID:-}" ]]; then
685 echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID." >&2
686 exit 1
687 fi
688​
689 router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
690 latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
691 nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
692 router_domain="${router_url#http://}"
693 router_domain="${router_domain#https://}"
694 router_domain="${router_domain%%/*}"
695​
696 if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
697 channel_domain="$latest_domain"
698 channel_name="latest"
699 else
700 channel_domain="$nightly_domain"
701 channel_name="nightly"
702 fi
703​
704 vercel_scope="${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
705 vercel_scope_args=(--scope "$vercel_scope")
706​
707 echo "Deploying hosted web app for $channel_name channel."
708 deployment_url="$(
709 vp dlx vercel@53.1.1 deploy \
710 --prod \
711 --skip-domain \
712 --yes \
713 --token "$VERCEL_TOKEN" \
714 "${vercel_scope_args[@]}" \
715 --build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
716 --build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
717 --build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
718 --build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
719 --build-env "VITE_HOSTED_APP_URL=$router_url" \
720 --build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
721 )"
722​
723 echo "Aliasing $deployment_url to $channel_domain."
724 vp dlx vercel@53.1.1 alias set "$deployment_url" "$channel_domain" \
725 --token "$VERCEL_TOKEN" \
726 "${vercel_scope_args[@]}"
727​
728 if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
729 echo "Aliasing $deployment_url to router domain $router_domain."
730 vp dlx vercel@53.1.1 alias set "$deployment_url" "$router_domain" \
731 --token "$VERCEL_TOKEN" \
732 "${vercel_scope_args[@]}"
733 fi
734​
735 finalize:
736 name: Finalize release
737 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
738 needs: [preflight, release]
739 runs-on: blacksmith-8vcpu-ubuntu-2404
740 timeout-minutes: 10
741 steps:
742 - id: app_token
743 name: Mint release app token
744 uses: actions/create-github-app-token@v2
745 with:
746 app-id: ${{ secrets.RELEASE_APP_ID }}
747 private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
748 owner: ${{ github.repository_owner }}
749​
750 - name: Checkout
751 uses: actions/checkout@v6
752 with:
753 ref: main
754 fetch-depth: 0
755 token: ${{ steps.app_token.outputs.token }}
756 persist-credentials: true
757​
758 - id: app_bot
759 name: Resolve GitHub App bot identity
760 env:
761 GH_TOKEN: ${{ steps.app_token.outputs.token }}
762 APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
763 run: |
764 user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
765 echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
766 echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
767​
768 - name: Setup Vite+
769 uses: voidzero-dev/setup-vp@v1
770 with:
771 node-version-file: package.json
772 cache: true
773 run-install: |
774 args:
775 - --filter=@t3tools/scripts...
776 - --filter=@t3tools/oxlint-plugin-t3code...
777​
778 - id: update_versions
779 name: Update version strings
780 env:
781 RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
782 run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
783​
784 - name: Format package.json files
785 if: steps.update_versions.outputs.changed == 'true'
786 run: vp fmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
787​
788 - name: Refresh lockfile
789 if: steps.update_versions.outputs.changed == 'true'
790 run: vp install --lockfile-only --ignore-scripts
791​
792 - name: Commit and push version bump
793 if: steps.update_versions.outputs.changed == 'true'
794 shell: bash
795 env:
796 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
797 run: |
798 if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml; then
799 echo "No version changes to commit."
800 exit 0
801 fi
802​
803 git config user.name "${{ steps.app_bot.outputs.name }}"
804 git config user.email "${{ steps.app_bot.outputs.email }}"
805​
806 git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
807 git commit -m "chore(release): prepare $RELEASE_TAG"
808 git push origin HEAD:main
809​
810 announce_discord:
811 name: Announce release on Discord
812 if: |
813 always() && !cancelled() &&
814 needs.preflight.result == 'success' &&
815 needs.relay_public_config.result == 'success' &&
816 needs.release.result == 'success' &&
817 needs.deploy_web.result == 'success' &&
818 (needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
819 needs: [preflight, relay_public_config, release, deploy_web, finalize]
820 runs-on: blacksmith-8vcpu-ubuntu-2404
821 timeout-minutes: 10
822 steps:
823 - name: Checkout
824 uses: actions/checkout@v6
825 with:
826 ref: ${{ needs.preflight.outputs.ref }}
827​
828 - name: Setup Vite+
829 uses: voidzero-dev/setup-vp@v1
830 with:
831 node-version-file: package.json
832 cache: true
833 run-install: |
834 args:
835 - --filter=@t3tools/scripts...
836​
837 - name: Announce prerelease on Discord
838 if: needs.preflight.outputs.is_prerelease == 'true'
839 continue-on-error: true
840 env:
841 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_NIGHTLY_ROLE_ID }}
842 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
843 run: |
844 node scripts/notify-discord-release.ts prerelease \
845 --role-id "$DISCORD_MENTION_ROLE_ID" \
846 --release-name "${{ needs.preflight.outputs.release_name }}" \
847 --release-version "${{ needs.preflight.outputs.version }}" \
848 --tag "${{ needs.preflight.outputs.tag }}" \
849 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"
850​
851 - name: Announce latest release on Discord
852 if: needs.preflight.outputs.make_latest == 'true'
853 continue-on-error: true
854 env:
855 DISCORD_MENTION_ROLE_ID: ${{ secrets.DISCORD_RELEASE_LATEST_ROLE_ID }}
856 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
857 run: |
858 node scripts/notify-discord-release.ts latest \
859 --role-id "$DISCORD_MENTION_ROLE_ID" \
860 --release-name "${{ needs.preflight.outputs.release_name }}" \
861 --release-version "${{ needs.preflight.outputs.version }}" \
862 --tag "${{ needs.preflight.outputs.tag }}" \
863 --release-url "https://github.com/${{ github.repository }}/releases/tag/${{ needs.preflight.outputs.tag }}"