perf(release): build Vercel deployments early and go live after publish (#14029)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
c57a04b722
commit
783ccf0fdd
2 files changed
+171
-48
No files matched your search
+157
-42
@@ -948,12 +948,20 @@ jobs:
|
||||
secrets:
|
||||
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||
|
||||
deploy_web:
|
||||
name: Deploy hosted web app
|
||||
needs: [preflight, relay_public_config, release]
|
||||
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
|
||||
# Vercel builds the hosted web app while the desktop jobs run. `--skip-domain`
|
||||
# keeps the custom domains (the channel and router domains) on the previous
|
||||
# deployment until deploy_web aliases them, after the GitHub Release. It does
|
||||
# still move the project's own *.vercel.app production hostname at build time.
|
||||
# That hostname sits behind Vercel SSO and is not a user channel, so the
|
||||
# npm-before-client order in docs/operations/release.md holds for users.
|
||||
build_web:
|
||||
name: Build hosted web app
|
||||
needs: [preflight, relay_public_config]
|
||||
if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
|
||||
runs-on: blacksmith-8vcpu-ubuntu-2404
|
||||
timeout-minutes: 10
|
||||
outputs:
|
||||
deployment_url: ${{ steps.deploy.outputs.deployment_url }}
|
||||
env:
|
||||
T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
|
||||
T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
|
||||
@@ -963,8 +971,6 @@ jobs:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
|
||||
T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
|
||||
T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
|
||||
VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -1006,7 +1012,8 @@ jobs:
|
||||
- name: Refresh release lockfile
|
||||
run: vp install --lockfile-only --ignore-scripts
|
||||
|
||||
- name: Deploy and alias channel
|
||||
- id: deploy
|
||||
name: Build staged deployment
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -1016,6 +1023,78 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
|
||||
if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
|
||||
channel_name="latest"
|
||||
else
|
||||
channel_name="nightly"
|
||||
fi
|
||||
|
||||
echo "Building hosted web app for $channel_name channel."
|
||||
deployment_url="$(
|
||||
vp dlx [email protected] deploy \
|
||||
--archive=tgz \
|
||||
--prod \
|
||||
--skip-domain \
|
||||
--yes \
|
||||
--token "$VERCEL_TOKEN" \
|
||||
--scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}" \
|
||||
--build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
|
||||
--build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
|
||||
--build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
|
||||
--build-env "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID=${T3CODE_CLERK_CLI_OAUTH_CLIENT_ID:-}" \
|
||||
--build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
|
||||
--build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=${T3CODE_RELAY_CLIENT_OTLP_TRACES_URL:-}" \
|
||||
--build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=${T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET:-}" \
|
||||
--build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=${T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN:-}" \
|
||||
--build-env "VITE_HOSTED_APP_URL=$router_url" \
|
||||
--build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
|
||||
)"
|
||||
echo "Staged $deployment_url."
|
||||
echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"
|
||||
|
||||
deploy_web:
|
||||
name: Deploy hosted web app
|
||||
needs: [preflight, build_web, release]
|
||||
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build_web.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
|
||||
runs-on: blacksmith-2vcpu-ubuntu-2404
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
DEPLOYMENT_URL: ${{ needs.build_web.outputs.deployment_url }}
|
||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
|
||||
T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
|
||||
T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
|
||||
VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ needs.preflight.outputs.ref }}
|
||||
sparse-checkout: |
|
||||
/*
|
||||
!/.repos/
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: false
|
||||
run-install: false
|
||||
|
||||
- name: Alias channel
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -z "$DEPLOYMENT_URL" ]]; then
|
||||
echo "Build hosted web app did not report a deployment URL." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
|
||||
latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
|
||||
nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
|
||||
@@ -1031,48 +1110,32 @@ jobs:
|
||||
channel_name="nightly"
|
||||
fi
|
||||
|
||||
vercel_scope="${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
|
||||
vercel_scope_args=(--scope "$vercel_scope")
|
||||
vercel_scope_args=(--scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}")
|
||||
|
||||
echo "Deploying hosted web app for $channel_name channel."
|
||||
deployment_url="$(
|
||||
vp dlx [email protected] deploy \
|
||||
--archive=tgz \
|
||||
--prod \
|
||||
--skip-domain \
|
||||
--yes \
|
||||
--token "$VERCEL_TOKEN" \
|
||||
"${vercel_scope_args[@]}" \
|
||||
--build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
|
||||
--build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \
|
||||
--build-env "T3CODE_CLERK_JWT_TEMPLATE=${T3CODE_CLERK_JWT_TEMPLATE:-}" \
|
||||
--build-env "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID=${T3CODE_CLERK_CLI_OAUTH_CLIENT_ID:-}" \
|
||||
--build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \
|
||||
--build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=${T3CODE_RELAY_CLIENT_OTLP_TRACES_URL:-}" \
|
||||
--build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=${T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET:-}" \
|
||||
--build-env "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=${T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN:-}" \
|
||||
--build-env "VITE_HOSTED_APP_URL=$router_url" \
|
||||
--build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
|
||||
)"
|
||||
|
||||
echo "Aliasing $deployment_url to $channel_domain."
|
||||
vp dlx [email protected] alias set "$deployment_url" "$channel_domain" \
|
||||
echo "Aliasing $DEPLOYMENT_URL to $channel_domain."
|
||||
vp dlx [email protected] alias set "$DEPLOYMENT_URL" "$channel_domain" \
|
||||
--token "$VERCEL_TOKEN" \
|
||||
"${vercel_scope_args[@]}"
|
||||
|
||||
if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
|
||||
echo "Aliasing $deployment_url to router domain $router_domain."
|
||||
vp dlx [email protected] alias set "$deployment_url" "$router_domain" \
|
||||
echo "Aliasing $DEPLOYMENT_URL to router domain $router_domain."
|
||||
vp dlx [email protected] alias set "$DEPLOYMENT_URL" "$router_domain" \
|
||||
--token "$VERCEL_TOKEN" \
|
||||
"${vercel_scope_args[@]}"
|
||||
fi
|
||||
|
||||
deploy_marketing:
|
||||
name: Deploy marketing site
|
||||
needs: [preflight, release]
|
||||
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
|
||||
# Same split as the web app: build a production deployment early, then
|
||||
# promote it to t3.codes once the release it links to exists. As above, the
|
||||
# project's own *.vercel.app hostname moves at build time.
|
||||
build_marketing:
|
||||
name: Build marketing site
|
||||
needs: [preflight]
|
||||
if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
|
||||
runs-on: blacksmith-8vcpu-ubuntu-2404
|
||||
timeout-minutes: 10
|
||||
outputs:
|
||||
deployment_url: ${{ steps.deploy.outputs.deployment_url }}
|
||||
project_id: ${{ steps.deploy.outputs.project_id }}
|
||||
env:
|
||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
@@ -1096,7 +1159,8 @@ jobs:
|
||||
args:
|
||||
- --filter=@t3tools/marketing...
|
||||
|
||||
- name: Deploy marketing site to Vercel
|
||||
- id: deploy
|
||||
name: Build staged deployment
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -1114,9 +1178,60 @@ jobs:
|
||||
)"
|
||||
export VERCEL_PROJECT_ID
|
||||
|
||||
vp dlx [email protected] deploy \
|
||||
--archive=tgz \
|
||||
--prod \
|
||||
deployment_url="$(
|
||||
vp dlx [email protected] deploy \
|
||||
--archive=tgz \
|
||||
--prod \
|
||||
--skip-domain \
|
||||
--yes \
|
||||
--token "$VERCEL_TOKEN" \
|
||||
--scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
|
||||
)"
|
||||
echo "Staged $deployment_url."
|
||||
echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"
|
||||
echo "project_id=$VERCEL_PROJECT_ID" >> "$GITHUB_OUTPUT"
|
||||
|
||||
deploy_marketing:
|
||||
name: Deploy marketing site
|
||||
needs: [preflight, build_marketing, release]
|
||||
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build_marketing.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
|
||||
runs-on: blacksmith-2vcpu-ubuntu-2404
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
DEPLOYMENT_URL: ${{ needs.build_marketing.outputs.deployment_url }}
|
||||
VERCEL_PROJECT_ID: ${{ needs.build_marketing.outputs.project_id }}
|
||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ needs.preflight.outputs.ref }}
|
||||
sparse-checkout: |
|
||||
/*
|
||||
!/.repos/
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: false
|
||||
run-install: false
|
||||
|
||||
- name: Promote marketing site
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -z "$DEPLOYMENT_URL" ]]; then
|
||||
echo "Build marketing site did not report a deployment URL." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Promoting $DEPLOYMENT_URL."
|
||||
vp dlx [email protected] promote "$DEPLOYMENT_URL" \
|
||||
--yes \
|
||||
--token "$VERCEL_TOKEN" \
|
||||
--scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
|
||||
|
||||
@@ -47,7 +47,7 @@ This document covers the unified release workflow for stable and nightly desktop
|
||||
- nightly releases publish npm dist-tag `nightly`
|
||||
- preview releases publish npm dist-tag `preview`, which nothing resolves unless asked for by name
|
||||
- one-time setup: the `@t3code` npm scope (org) must exist, and `t3` and each `@t3code/t3-<platform>-<arch>` package needs a trusted publisher registered for this workflow file (see below).
|
||||
- Deploys the hosted web app to Vercel only after a release is published:
|
||||
- Builds the hosted web app on Vercel while the desktop jobs run, and makes it live only after a release is published:
|
||||
- stable releases are aliased to the `latest` hosted app channel
|
||||
- nightly releases are aliased to the `nightly` hosted app channel
|
||||
- Signing is optional and auto-detected per platform from secrets.
|
||||
@@ -211,9 +211,11 @@ stage, test Cloudflare account, disposable host, and disposable T3 home. Keep pr
|
||||
|
||||
## Marketing site deployment
|
||||
|
||||
After a nightly release is published, the release workflow deploys the same commit
|
||||
to the marketing site's Vercel production project. Stable releases do not deploy
|
||||
the marketing site because they can promote an older nightly commit.
|
||||
On nightly releases, the release workflow builds the same commit as a staged
|
||||
production deployment of the marketing site's Vercel project while the desktop
|
||||
jobs run, and promotes it with `vercel promote` after the release is published.
|
||||
Stable releases do not deploy the marketing site because they can promote an
|
||||
older nightly commit.
|
||||
|
||||
The job looks up the `t3code-marketing` project using the existing `VERCEL_TOKEN`
|
||||
and `VERCEL_ORG_ID` secrets. It also respects the optional `VERCEL_TEAM_SLUG`
|
||||
@@ -224,8 +226,10 @@ Git deployments remain disabled in `apps/marketing/vercel.ts`.
|
||||
|
||||
The hosted app is intentionally not deployed by Vercel's Git integration. The
|
||||
web project disables automatic Git deployments in `apps/web/vercel.ts` via
|
||||
`git.deploymentEnabled: false`, and `.github/workflows/release.yml` deploys the
|
||||
web app with Vercel CLI after the GitHub Release succeeds.
|
||||
`git.deploymentEnabled: false`. `.github/workflows/release.yml` builds the web
|
||||
app with Vercel CLI as a staged production deployment (`--skip-domain`) while
|
||||
the desktop jobs run, and aliases the channel domains to it after the GitHub
|
||||
Release succeeds.
|
||||
|
||||
Required GitHub Actions secrets:
|
||||
|
||||
@@ -302,6 +306,10 @@ The workflow enforces this ordering:
|
||||
1. `publish_cli` publishes the exact release version to npm, on every channel.
|
||||
2. `release` depends on `publish_cli` before exposing desktop artifacts in GitHub Releases.
|
||||
3. `deploy_web` depends on `release` before moving the hosted channel to the new client.
|
||||
`build_web` builds that client earlier with `vercel deploy --prod --skip-domain`, which
|
||||
leaves the custom domains alone but moves the project's own `*.vercel.app` production
|
||||
hostname. That hostname is behind Vercel SSO, so users only get the client through the
|
||||
custom domains.
|
||||
|
||||
Preserve these dependencies when changing the release graph. Publishing a client first would leave
|
||||
the **Update server** action targeting a package version that does not exist yet.
|
||||
|
||||
Reference in new issue
Block a user