Skip to content

Commit ab2c7b9

Browse files
Document the GitHub Actions push-to-deploy flow for Composer apps (#8173)
* Document the GitHub Actions push-to-deploy flow for Composer apps The GitHub integration page described platform-side webhook builds ("push builds the pushed commit"), which is not how deploys work: deploys run in the repository's own GitHub Actions through prisma/cloud-deploy-action, while the connection contributes the OIDC credential exchange and the branch lifecycle automation (preview teardown on branch delete). - Add compute/deploy-on-push.mdx: a walkthrough from a locally deployed Composer app to push-to-deploy with per-branch preview stages, validated end to end against a real pipeline on 2026-08-25. - Rewrite compute/github.mdx around what the connection actually does, including the two entry paths (Console adds the workflow via PR, the CLI path does not) and the interactive-only git connect. - Align branching, deployments, index, cli/v8/git, composer/deploying, and the full-stack tutorial's next step with the real flow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Rework the push-to-deploy pages to follow the docs-writer style Apply the docs-writer skill's conventions to the new and rewritten pages: remove em dashes, contrast slogans, coined phrasings, and stacked absolutes; move failure notes inline with the step where the reader hits them instead of a separate troubleshooting section; trim the next-steps lists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 71b34b7 commit ab2c7b9

9 files changed

Lines changed: 175 additions & 37 deletions

File tree

apps/docs/content/docs/(index)/full-stack-tutorial.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,4 @@ npx prisma@latest project delete <project-id> --confirm <project-id>
259259
- [Pick your framework](/guides): the same journey for Next.js, Nuxt, Astro, NestJS, TanStack Start, and more.
260260
- [Branching and previews](/compute/branching): every Git branch gets an isolated deployment.
261261
- [Learn the fundamentals](/orm/fundamentals/reading-data): reading, writing, relations, and transactions.
262-
- [Deploy on push](/compute/github): connect GitHub so every commit deploys itself.
262+
- [Deploy on push](/compute/deploy-on-push): connect GitHub so every commit deploys itself, with a preview environment per branch.

apps/docs/content/docs/cli/git.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ metaTitle: git | Prisma 8 CLI
66
metaDescription: Learn how to connect and disconnect a GitHub repository for Prisma Compute push-to-deploy with the unified Prisma CLI.
77
---
88

9-
Use `git` commands to manage the GitHub repository connection. See [GitHub integration](/compute/github).
9+
Use `git` commands to manage the GitHub repository connection. Connecting enables the OIDC credential exchange for GitHub Actions deploys and the branch lifecycle automation. See [GitHub integration](/compute/github) and [Deploy on push](/compute/deploy-on-push).
1010

1111
## Usage
1212

1313
```npm
1414
npx prisma@latest git connect
1515
```
1616

17+
Run it from a [linked](/cli/project) project directory. The command needs an interactive terminal: it opens the browser to install the GitHub App when needed and waits for the install. With `--no-interactive` it fails with `CLI.INTERACTION_REQUIRED`. Connecting from the CLI does not add a deploy workflow to the repository. [Add it yourself](/compute/deploy-on-push#4-add-the-deploy-workflow), or connect through the [Console](https://pris.ly/pdp), which opens a pull request with the workflow.
18+
1719
## Commands
1820

1921
| Command | Description |
2022
| ------------------------ | ----------------------------------------------------------------- |
2123
| `git connect [git-url]` | Connect the linked project to a GitHub repository. Starts the GitHub App install flow if needed |
22-
| `git disconnect` | Stop push-triggered automation. Keeps the project and existing branches |
24+
| `git disconnect` | Stop the credential exchange and branch automation. Keeps the project and existing branches |

apps/docs/content/docs/composer/deploying.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ Destroying a stage removes its resources, then deletes its branch along with the
108108

109109
## CI
110110

111-
CI runs the same commands as your machine: set the two credential variables as CI secrets, build, and deploy. The per-PR environment pattern:
111+
On GitHub, connect the repository and add [prisma/cloud-deploy-action](https://github.com/prisma/cloud-deploy-action) to a workflow instead of scripting the deploy yourself. The action derives the target from the branch: the default branch deploys production, and every other branch deploys a stage named after it. Connected repositories authenticate through GitHub's OIDC tokens, without a stored secret. [Deploy on push](/compute/deploy-on-push) walks through the setup.
112+
113+
Any other CI runs the same commands as your machine: set the two credential variables as CI secrets, build, and deploy. The per-PR environment pattern:
112114

113115
```npm
114116
npx prisma@latest deploy module.ts --stage "pr-$PR_NUMBER" # on push

apps/docs/content/docs/compute/branching.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Listing branches doesn't expand the services and databases inside them. Use the
4747

4848
You rarely create branches manually. They are created automatically:
4949

50-
- **From GitHub**: when a repo is connected, branch and push events create or update the matching platform branch automatically. To set this up, see the [GitHub integration docs](/compute/github).
50+
- **From GitHub**: when a repo is connected, creating a Git branch creates the matching platform branch, and your repository's [deploy workflow](/compute/deploy-on-push) deploys each push to it as a preview. To set this up, see the [GitHub integration docs](/compute/github).
5151
- **From the CLI**: commands that target a branch that doesn't exist yet, such as `service create --branch feature/search` or a [Composer stage deploy](/composer/deploying), create it.
5252

5353
Connecting GitHub doesn't create branches retroactively. It aligns your default branch with the repo's default branch and wires up automation for future events.
@@ -59,4 +59,5 @@ When GitHub is connected, deleting a Git branch tears down the matching platform
5959
## Next steps
6060

6161
- [Environment variables](/compute/environment-variables): preview values and per-branch overrides.
62+
- [Deploy on push](/compute/deploy-on-push): a preview environment for every branch you push.
6263
- [GitHub integration](/compute/github): keep platform branches in sync with your repo.
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
title: Deploy on push
3+
description: Graduate a Composer app from manual deploys to a Git workflow, with production deploys on push and an isolated preview environment per branch.
4+
url: /compute/deploy-on-push
5+
metaTitle: Deploy on push | Prisma Compute
6+
metaDescription: Connect a GitHub repository and deploy a Prisma Composer app from GitHub Actions with prisma/cloud-deploy-action - production on the default branch, isolated preview stages per branch, automatic teardown.
7+
---
8+
9+
You have a [Composer](/composer) app that you deploy by running `deploy module.ts` in a terminal. In this guide you connect its GitHub repository and add a deploy workflow, so pushing replaces that manual step: a push to the default branch updates production, every other branch gets an isolated preview environment, and deleting a branch cleans its preview up.
10+
11+
## How it works
12+
13+
Push-to-deploy has two parts, and you set up both:
14+
15+
1. **The repository connection.** [`git connect`](/cli/git) installs the Prisma GitHub App and registers the repository with your project. This lets workflow runs authenticate: a job exchanges its GitHub OIDC token for a Prisma workspace token that expires after 30 minutes, so the workflow needs no repository secrets. The connection also subscribes the project to branch events, which is what tears a preview down when its Git branch is deleted.
16+
2. **The deploy workflow.** [prisma/cloud-deploy-action](https://github.com/prisma/cloud-deploy-action) runs in your repository's GitHub Actions. On each push it installs dependencies, runs your build, and runs the [`deploy` command](/cli/deploy) against production or a stage named after the branch.
17+
18+
Connecting a repository does not deploy it; deploys come from the workflow. Without the connection, the workflow has no credential: the action prints a notice, sets its `outcome` output to `skipped-no-credential`, and exits successfully, so the run stays green.
19+
20+
You can connect in the [Console](https://pris.ly/pdp) or from the CLI. The Console opens a pull request that adds the workflow file at the same time. The CLI registers the connection only, and you add the workflow file yourself. This guide uses the CLI.
21+
22+
## Prerequisites
23+
24+
- A Composer app that builds and deploys from your machine. The [full-stack tutorial](/full-stack-tutorial) ends with one.
25+
- Admin access to the GitHub repository, so you can install the Prisma GitHub App on it.
26+
27+
## 1. Push the project to GitHub
28+
29+
If the app is not on GitHub yet, create a repository from the project directory and push it. With the [GitHub CLI](https://cli.github.com/):
30+
31+
```bash
32+
gh repo create my-app --private --source . --push
33+
```
34+
35+
## 2. Link the directory to the project
36+
37+
The `git` commands operate on the project this directory is linked to. If you have deployed from this directory before, it is already linked and you can skip this step. Otherwise, link it to the project your deploys created:
38+
39+
```npm
40+
npx prisma@latest project link my-app
41+
```
42+
43+
Run the command in the project root, next to `module.ts`. Linking records the current directory, and it accepts a parent directory without a warning. If later commands fail with `PROJECT.SETUP_REQUIRED`, re-run `project link` from the project root. See the [`project` command reference](/cli/project) for how the link is stored and resolved.
44+
45+
## 3. Connect the repository
46+
47+
Connect the project to the repository from step 1:
48+
49+
```npm
50+
npx prisma@latest git connect https://github.com/you/my-app
51+
```
52+
53+
The command opens your browser to install the Prisma GitHub App if it is not installed yet, then registers the connection. It needs an interactive terminal. With `--no-interactive` it fails with `CLI.INTERACTION_REQUIRED`; if you cannot run it interactively, connect through the [Console](https://pris.ly/pdp) instead.
54+
55+
## 4. Add the deploy workflow
56+
57+
Commit a workflow that runs the deploy action on every push:
58+
59+
```yaml title=".github/workflows/prisma-deploy.yml"
60+
name: prisma-deploy
61+
62+
on:
63+
push:
64+
65+
concurrency:
66+
group: prisma-deploy-${{ github.ref }}
67+
cancel-in-progress: false
68+
69+
permissions:
70+
contents: read
71+
id-token: write
72+
73+
jobs:
74+
deploy:
75+
if: github.ref_type == 'branch'
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: actions/setup-node@v4
80+
with:
81+
node-version: 22
82+
- uses: oven-sh/setup-bun@v2
83+
- uses: prisma/cloud-deploy-action@v1
84+
with:
85+
build-command: npm run build
86+
```
87+
88+
A few settings to be aware of:
89+
90+
- `id-token: write` lets the job request the OIDC token that the action exchanges for a workspace token. Without this permission the exchange cannot happen and the run skips.
91+
- `build-command` runs verbatim. The action does not detect your framework or build for you. If the app runs its source directly, set `build-command: none`.
92+
- The action requires Bun on the runner PATH, which `oven-sh/setup-bun@v2` provides.
93+
94+
When the repository has a `prisma` devDependency, the action deploys with that installed version, so keep it current. The action's [README](https://github.com/prisma/cloud-deploy-action) documents the remaining inputs, including `module` for an entry file that is not `module.ts` and `working-directory` for monorepos.
95+
96+
## 5. Push to deploy production
97+
98+
Commit the workflow and push to your default branch. In the repository's **Actions** tab, the `prisma-deploy` run installs, builds, and deploys, and ends with the same deploy report you know from your terminal:
99+
100+
```text no-copy
101+
my-app
102+
├─ db postgres-database db_def456
103+
└─ api compute-service cps_abc123
104+
https://xyz.ewr.prisma.build
105+
```
106+
107+
Every later push to the default branch updates production the same way, as if you had run `deploy module.ts` yourself.
108+
109+
If the deploy step fails with `CLI.UNKNOWN_COMMAND`, the action release predates the unified CLI: releases up to v1.5.0 call the removed `prisma composer` commands. Use a release that runs the top-level `deploy` command; the action's [releases page](https://github.com/prisma/cloud-deploy-action/releases) lists what changed in each. If the run is green but its log shows `skipped-no-credential`, the repository is not connected; repeat step 3. Runs triggered from forks skip the same way, because GitHub does not issue OIDC tokens to them, so contributors' pushes keep a green CI without reaching your workspace.
110+
111+
## 6. Preview a branch
112+
113+
Push a branch to try the preview flow:
114+
115+
```bash
116+
git switch -c feature/search
117+
git push -u origin feature/search
118+
```
119+
120+
The action deploys the branch as a [stage](/composer/deploying#production-and-stages) named after it, which is a [preview branch](/compute/branching) of the same project. The preview has its own services, its own databases assigned to that branch, its own buckets, and its own URL. The only thing it shares with production is the code. Confirm it from your terminal:
121+
122+
```npm
123+
npx prisma@latest service list --branch feature/search
124+
```
125+
126+
Further pushes to the branch update the same preview. Its configuration comes from the branch's [environment variables](/compute/environment-variables), so a preview reads preview-scoped values rather than production ones.
127+
128+
## 7. Delete the branch to clean up
129+
130+
When the branch has served its purpose, delete it:
131+
132+
```bash
133+
git push origin --delete feature/search
134+
```
135+
136+
The platform tears down the matching preview: its services, databases, and buckets are removed. This automation comes from the connection you set up in step 3, so it runs whether or not a workflow fires for the deletion. Automated cleanup skips your production and default branches.
137+
138+
## Next steps
139+
140+
- [GitHub integration](/compute/github): what the repository connection is and does.
141+
- [Branching](/compute/branching): how preview branches relate to Git branches.
142+
- [Deploying](/composer/deploying): stages, deploy state, and per-stage secrets, which apply to CI deploys too.

apps/docs/content/docs/compute/deployments.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A deploy produces a **version** of a service: one built artifact that can serve
1212

1313
Versions are created three ways:
1414

15-
- **A git push.** After you [connect a GitHub repository](/compute/github), pushing a branch builds and deploys it: the default Git branch deploys to production, and every other branch gets an isolated preview.
15+
- **A git push.** After you [set up deploy on push](/compute/deploy-on-push), your repository's GitHub Actions workflow builds and deploys each pushed branch: the default Git branch deploys to production, and every other branch gets an isolated preview.
1616
- **The [Console](https://pris.ly/pdp).** Trigger a build and deploy from the browser.
1717
- **[`deploy`](/cli/deploy).** For a [Prisma Composer](/composer) app, `deploy` assembles the services you have already built and provisions them from your terminal or CI.
1818

@@ -80,6 +80,6 @@ This permanently deletes the service from the branch you target with `--branch`.
8080
## Next steps
8181

8282
- [Environment variables](/compute/environment-variables): persist config across deploys.
83-
- [GitHub integration](/compute/github): the push-to-deploy flow in detail.
83+
- [Deploy on push](/compute/deploy-on-push): the push-to-deploy flow in detail.
8484
- [Domains](/compute/domains): point a custom domain at production.
8585
- [Prisma Composer](/composer): declare the app the `deploy` command deploys.
Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
---
22
title: GitHub
3-
description: Connect a GitHub repository to a project and Prisma deploys on every push, with previews tracking your Git branches.
3+
description: Connect a GitHub repository to a project to authenticate your Actions deploys and keep platform branches in sync with your Git branches.
44
url: /compute/github
55
metaTitle: GitHub integration | Prisma Compute
6-
metaDescription: Connect a GitHub repository to Prisma Compute, deploy on push, and map repository branches to platform branches automatically.
6+
metaDescription: Connect a GitHub repository to Prisma Compute to enable OIDC-authenticated deploys from GitHub Actions and automatic preview teardown when branches are deleted.
77
---
88

9-
Connect a GitHub repository to a project and Prisma deploys on every push. Branch and push events map to platform branches automatically, so your previews track your Git branches.
9+
Connecting a GitHub repository wires a project to your repo. Deploys run in your own GitHub Actions, through [prisma/cloud-deploy-action](https://github.com/prisma/cloud-deploy-action); the connection provides two things around them:
10+
11+
- **Credentials.** Workflow runs in the connected repository exchange their GitHub OIDC token for a short-lived Prisma workspace token, so the deploy workflow needs no secrets.
12+
- **Branch lifecycle.** Branch events keep the matching platform branches in sync, including tearing a preview down when its Git branch is deleted.
13+
14+
For the full setup, from connection to a live preview per branch, follow [Deploy on push](/compute/deploy-on-push).
1015

1116
## How it works
1217

1318
The connection has two levels:
1419

1520
<ConceptAnimation name="github-connection" />
1621

17-
The workspace owns the GitHub App installation; each project points at a single repository. Once connected, Prisma listens for that repo's branch events and keeps the matching platform branches in sync.
22+
The workspace owns the GitHub App installation; each project points at a single repository. Once connected, Prisma verifies the repository identity behind each credential exchange and listens for the repo's branch events.
1823

1924
In beta, a project connects to one repository.
2025

2126
## Connect a repo
2227

28+
You can connect through the [Console](https://pris.ly/pdp) or from the CLI. The Console also opens a pull request that adds the deploy workflow to the repository. The CLI sets up the connection only, and you [add the workflow yourself](/compute/deploy-on-push#4-add-the-deploy-workflow).
29+
2330
From a linked project directory, connect your Git origin:
2431

2532
```npm
@@ -32,49 +39,32 @@ To name the repository explicitly:
3239
npx prisma@latest git connect https://github.com/acme/shop
3340
```
3441

35-
If the GitHub App isn't installed yet, the CLI starts the install flow. In `--json` / `--no-interactive` mode it doesn't block: it prints the install URL to finish in the browser, so automation can hand the install off:
36-
37-
```npm
38-
npx prisma@latest git connect https://github.com/acme/shop --json --no-interactive
39-
```
42+
If the GitHub App isn't installed yet, the CLI opens the browser to finish the install. The command needs an interactive terminal: it waits for the install to complete, and `--no-interactive` fails with `CLI.INTERACTION_REQUIRED`. For headless setups, connect through the Console instead.
4043

4144
Disconnect when you're done:
4245

4346
```npm
4447
npx prisma@latest git disconnect
4548
```
4649

47-
Disconnecting stops future automation. It doesn't delete the project or tear down existing branches.
50+
Disconnecting stops the credential exchange and the branch automation. It doesn't delete the project or tear down existing branches.
4851

49-
## What events do
52+
## What the connection does
5053

5154
Once a project is connected:
5255

56+
- **Actions runs can authenticate.** A workflow job with `id-token: write` gets a workspace token through the OIDC exchange. The token is valid for 30 minutes and is only issued for the connected repository; unconnected repositories and forks are refused, and the deploy action then skips with a green run.
5357
- **Branch created** → creates the matching platform branch.
54-
- **Push** → creates or resolves the matching branch and builds the pushed commit.
55-
- **Branch deleted** → tears down the matching branch, unless it's the production or default branch.
56-
57-
Connecting doesn't deploy anything on its own. It wires up automation for *future* events. Push a commit to trigger the first build.
58-
59-
## CI and monorepos
60-
61-
For an app with several services, declare them with [Prisma Composer](/composer) and deploy from CI with the [`deploy` command](/cli/deploy). Watch a service from CI or a terminal with a service token and explicit targets:
62-
63-
```bash
64-
PRISMA_SERVICE_TOKEN=... npx prisma@latest service show web \
65-
--project my-app \
66-
--json \
67-
--no-interactive
68-
```
58+
- **Branch deleted** → tears down the matching platform branch and its resources. Your production and default branches are exempt from this cleanup.
6959

70-
For pipelines that need a CLI-driven deploy rather than the push automation, use [Prisma Composer](/composer/deploying), which deploys from any CI with the same service token.
60+
Pushes are not handled by the platform. Your repository's own workflow deploys them, so a connected repo without a deploy workflow deploys nothing. Connecting also doesn't create branches retroactively: it aligns your default branch with the repo's default branch and wires up automation for future events.
7161

7262
## What's not in beta
7363

74-
GitHub is the only supported provider; others return `REPO_PROVIDER_UNSUPPORTED`. The webhook path is branch- and push-driven. Each webhook deploy posts a "Prisma Compute Deploy" check run on the commit (success or failure, with the deploy URL) on a best-effort basis. Pull-request comments and preview comments aren't part of the beta surface.
64+
GitHub is the only supported provider; others return `REPO_PROVIDER_UNSUPPORTED`. Pull-request comments and preview comments aren't part of the beta surface.
7565

7666
## Next steps
7767

68+
- [Deploy on push](/compute/deploy-on-push): the full walkthrough, from connection to per-branch previews.
7869
- [Branching](/compute/branching): how platform branches map to Git.
79-
- [Deployments](/compute/deployments): what happens after a push builds.
8070
- [Environment variables](/compute/environment-variables): per-branch config for previews.

0 commit comments

Comments
 (0)