Skip to content
TypeScript

ci(release): preview releases run from any branch (#27828)

Julius Marminge333f7a6f6e6b
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c36d51bdadb..82f39f8034c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -395,8 +395,12 @@ jobs:
(github.event_name != 'schedule' || needs.resolve_commit.outputs.has_changes == 'true')
runs-on: blacksmith-8vcpu-ubuntu-2404
timeout-minutes: 5
+ # Previews build any branch, but production admits only main and v* tags.
+ # The empty name runs previews with no environment, so their Clerk and relay
+ # ids come from .env.example. Everything else matches nightly: the tracing
+ # read below needs only repository-level Cloudflare credentials.
environment:
- name: production
+ name: ${{ inputs.channel != 'preview' && 'production' || '' }}
outputs:
clerk_publishable_key: ${{ steps.public_config.outputs.clerk_publishable_key }}
clerk_jwt_template: ${{ steps.public_config.outputs.clerk_jwt_template }}
@@ -462,9 +466,19 @@ jobs:
- id: public_config
name: Resolve production relay public config
shell: bash
+ env:
+ PREVIEW: ${{ inputs.channel == 'preview' }}
run: |
set -euo pipefail
+ if [[ "$PREVIEW" == "true" ]]; then
+ env_example() { sed -n "s|^T3CODE_$1=||p" .env.example; }
+ CLERK_PUBLISHABLE_KEY="$(env_example CLERK_PUBLISHABLE_KEY)"
+ CLERK_JWT_TEMPLATE="$(env_example CLERK_JWT_TEMPLATE)"
+ CLERK_CLI_OAUTH_CLIENT_ID="$(env_example CLERK_CLI_OAUTH_CLIENT_ID)"
+ RELAY_DOMAIN="$(sed -n 's|^T3CODE_RELAY_URL=https://||p' .env.example)"
+ fi
+
relay_domain="${RELAY_DOMAIN:-}"
if [[ -z "$relay_domain" && -n "${RELAY_API_ZONE_NAME:-}" ]]; then
relay_domain="relay.$RELAY_API_ZONE_NAME"
diff --git a/docs/operations/release.md b/docs/operations/release.md
index 29b9a2b9bfb..4dd489bfde0 100644
--- a/docs/operations/release.md
+++ b/docs/operations/release.md
@@ -106,9 +106,13 @@ The relay is a shared control plane versioned separately from client releases. S
client builds must point at the same relay so users see the same linked environments when switching
release channels.
-`.github/workflows/deploy-relay.yml` deploys Alchemy stage `prod` on every push to `main`. The
-release workflow reads the relay URL and Clerk client configuration from the existing `production`
-GitHub Actions environment before building desktop, CLI, or hosted web artifacts.
+`.github/workflows/deploy-relay.yml` deploys Alchemy stage `prod` on every push to `main`. Stable
+and nightly releases read the relay URL and Clerk client configuration from the existing
+`production` GitHub Actions environment before building desktop, CLI, or hosted web artifacts. That
+environment admits only `main` and `v*` tags, so preview releases, which may run from any branch,
+take the same public identifiers from `.env.example`; keep it in step with the `production` values.
+Every channel reads the relay client tracing config from Alchemy state with the repository-level
+`CLOUDFLARE_API_TOKEN`, so moving that token into `production` would break preview releases.
Required repository variables shared by relay deployments: