11# Compute Preview Deploys
22
3- This document is normative for branch-scoped Compute preview deployments.
3+ This document is normative for branch-scoped and latest-main Compute preview
4+ deployments.
45
56## Purpose
67
7- Pull requests need a live Studio preview without manually creating and cleaning up
8- Compute services for every branch .
8+ Pull requests and the latest ` main ` branch need live Studio previews without
9+ manually creating and cleaning up Compute services .
910
1011The preview deployment path uses the existing ` pnpm build:deploy ` artifact and
1112publishes it into the dedicated Compute project named ` studio-preview ` .
@@ -14,6 +15,7 @@ publishes it into the dedicated Compute project named `studio-preview`.
1415
1516- A preview deploy MUST run when a pull request is opened, reopened, or updated
1617 with new commits.
18+ - A stable ` main ` preview deploy MUST run whenever ` main ` receives new commits.
1719- Preview deploys MUST only run for branches inside this repository. Forked pull
1820 requests MUST NOT receive the Compute token.
1921- A preview service MUST be destroyed when the corresponding Git branch is
@@ -24,7 +26,9 @@ publishes it into the dedicated Compute project named `studio-preview`.
2426
2527## Service Naming
2628
27- - Preview services MUST be keyed by the pull request branch name.
29+ - Pull request preview services MUST be keyed by the pull request branch name.
30+ - The latest-main preview service MUST be keyed by the literal branch name
31+ ` main ` .
2832- Because Compute service names need a filesystem- and URL-safe shape, the raw
2933 branch name MUST be normalized to a lowercase slug containing only
3034 alphanumeric segments separated by ` - ` .
@@ -45,8 +49,22 @@ publishes it into the dedicated Compute project named `studio-preview`.
4549- If the service already exists, the helper MUST deploy a new version to that
4650 same service.
4751- Deployments MUST use the published CLI entrypoint:
48- - ` bunx @prisma/compute-cli@latest deploy --skip-build --path deploy --entrypoint bundle/compute-entrypoint.js --http-port 8080 ` .
49- - The Compute artifact MUST include ` bundle/compute-entrypoint.js ` , which defaults ` STUDIO_DEMO_PORT ` to ` 8080 ` before importing ` bundle/server.bundle.js ` . Preview deploys MUST NOT pass runtime environment variables through the Compute CLI while its deploy API rejects the CLI's ` envVars ` request key.
52+ ` bunx @prisma/compute-cli@latest deploy --skip-build --path deploy --entrypoint bundle/compute-entrypoint.js --http-port 8080 ` .
53+ - The Compute artifact MUST include ` bundle/compute-entrypoint.js ` , which
54+ defaults ` STUDIO_DEMO_PORT ` to ` 8080 ` before importing
55+ ` bundle/server.bundle.js ` .
56+ - Preview deploys MUST pass runtime environment through a temporary Compute CLI
57+ env file rather than embedding secrets into the artifact.
58+ - Preview runtime env MUST include ` STUDIO_DEMO_PORT=8080 ` ,
59+ ` STUDIO_DEMO_AI_ENABLED=true ` , and ` ANTHROPIC_API_KEY ` from the GitHub
60+ Actions secret ` STUDIO_PREVIEW_ANTHROPIC_API_KEY ` .
61+
62+ ## Main Preview
63+
64+ - The stable preview for the latest ` main ` MUST use ` main ` as the service key so
65+ the Compute service URL remains stable across pushes.
66+ - Successful ` main ` preview deploys SHOULD write the live service URL to the
67+ GitHub Actions job summary.
5068
5169## PR Feedback
5270
0 commit comments