Skip to content

Commit d613f48

Browse files
ci(publish): a failing dev build no longer blocks the release, which runs as its own job (unblocks 8.0.0-rc.37) (#423)
## What this fixes 8.0.0-rc.37 is not on npm. #420 merged it, but the publish run failed before any release step ran ([run](https://github.com/prisma/prisma-cli/actions/runs/46844536826)). Nothing reached npm, and there is no git tag and no GitHub Release. `publish.yml` publishes a dev build and the release in one job, dev build first. The dev build's check failed, so the job stopped before the release half. The dev build failed for a reason unrelated to the release: - The dev build pins each product to its `dev` dist-tag. The CLI took the ORM's `dev`, 8.0.1-dev.42, and Composer's `dev`, 0.41.0-dev.1. - But Composer 0.41.0-dev.1 depends on ORM 8.0.0-rc.26 exactly. So the install held two versions of `@prisma/orm-toolchain`. - The conformance check installs the packed CLI and checks, among other things, that the shell's ORM pin is the version actually installed. It refused. The release pins ORM 8.0.0-rc.26 and Composer 0.41.0, which agree. Its checks never ran. After this PR, the workflow has three jobs: ```text version reads the root package.json; decides the dev version and whether this run releases dev stamps, builds, checks and publishes the dev build (needs: version) release builds, checks and publishes the committed version (needs: version; only on a release) ``` `dev` and `release` run side by side, so a failing dev build no longer stops a release, and the reverse. ## How rc.37 publishes after this merges Merging this does not publish rc.37. A push releases only when it changes the root version, and this merge does not. Re-running the failed run would not help either: a re-run uses that run's own workflow file, with the old single job. So a maintainer dispatches `Publish to npm` from `main`, with `dist-tag` empty and `dry-run` off. A dispatch is a full release run, unchanged by this PR: the release checks, the publish under `next`, the git tag `v8.0.0-rc.37`, and a pre-release GitHub Release not marked "Latest". That run will show red, because its dev build still fails. The `release` job's result is what counts. The dev build stays red until the products' dev builds agree again. Fixing that is not part of this PR; the release coordinator is taking it to Will. The choice is between: - Composer's dev builds following the ORM's dev builds; - the CLI's dev build taking the ORM version that Composer's dev build depends on. ## What changes - `publish.yml`, beyond the three jobs above: - The `release` job drops the "Restore the committed versions" step. That step undid the dev build's version stamp in the shared workspace. The release job starts from its own clean checkout. - Each job publishes `@prisma/cli-engine` after its own checks and before its own CLI publish, as the single job did, so a CLI version never reaches npm without its engine. `publish-packages.sh` treats a version already on npm as done. If both jobs publish the engine at the same moment, the second gets npm's "already published" error, which that script also treats as done. A dev build could already publish the engine when the release half would have failed later, so this is not new. - The dev step and artifact that `check-dev-build-with-cloud-deploy-action.yml` reads keep their names. That workflow searches every job's steps, so it still finds them. - Docs: - `docs/oss/versioning.md` says the two halves are separate jobs and why, and says what a dry run actually does. - `docs/oss/release-automation.md` gains a troubleshooting row for a run that is red at the dev check: read the release job first. ## How it was checked - `actionlint` is clean. - A dry-run dispatch of this branch ([run](https://github.com/prisma/prisma-cli/actions/runs/46845221680)), on rc.37 as committed on `main`: - `release` built rc.37, passed `check:grammar` and conformance, uploaded the tarballs, and skipped only the publish steps, as a dry run does. - `dev` failed at its check for the reason above, and did not stop `release`. - A code review by a separate reviewer found nothing wrong in the workflow. Its comment and doc fixes are in. ## Alternatives considered - **Make the dev check non-blocking (`continue-on-error`) inside the one job.** Rejected: a dev build that fails its checks must not publish. Only its effect on the release should go. - **Skip the dev build when a run releases.** Rejected: that is how the workflow used to work. The release commit then never reached the `dev` tag, so `dev` named an older version than the release until an unrelated commit landed. Agent: cobain-55 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent a067110 commit d613f48

3 files changed

Lines changed: 92 additions & 36 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 88 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,20 @@ concurrency:
3131
cancel-in-progress: false
3232

3333
jobs:
34-
publish:
35-
name: Publish packages to npm
34+
version:
35+
name: Determine the version
3636
runs-on: ubuntu-latest
3737
# Only `main` publishes; a dry-run dispatch may validate the pipeline
3838
# from any branch.
3939
if: ${{ github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry-run == 'true') }}
4040
permissions:
41-
contents: write # Required to create the GitHub Release + tag for releases
42-
id-token: write # Required for npm OIDC Trusted Publishing
43-
41+
contents: read
42+
outputs:
43+
devVersion: ${{ steps.version.outputs.devVersion }}
44+
release: ${{ steps.version.outputs.release }}
45+
releaseVersion: ${{ steps.version.outputs.releaseVersion }}
46+
releaseTag: ${{ steps.version.outputs.releaseTag }}
47+
githubRelease: ${{ steps.version.outputs.githubRelease }}
4448
steps:
4549
- name: Checkout
4650
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -50,6 +54,36 @@ jobs:
5054
# multi-commit push can place arbitrarily far back.
5155
fetch-depth: 0
5256

57+
- name: Set up Node.js
58+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
59+
with:
60+
node-version-file: .node-version
61+
62+
- name: Determine version
63+
id: version
64+
env:
65+
GITHUB_EVENT_NAME: ${{ github.event_name }}
66+
INPUT_DIST_TAG: ${{ github.event.inputs.dist-tag }}
67+
PUSH_BEFORE_SHA: ${{ github.event.before }}
68+
run: node scripts/determine-version.ts
69+
70+
# The dev build and the release are separate jobs, so a failing dev
71+
# build never holds back a release: the dev build takes the products'
72+
# dev builds, which can disagree with each other while the release's
73+
# pinned versions are fine.
74+
dev:
75+
name: Publish the dev build
76+
needs: version
77+
runs-on: ubuntu-latest
78+
permissions:
79+
contents: read
80+
id-token: write # Required for npm OIDC Trusted Publishing
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
84+
with:
85+
persist-credentials: false
86+
5387
- name: Set up pnpm
5488
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
5589

@@ -65,21 +99,11 @@ jobs:
6599
- name: Install dependencies
66100
run: pnpm install --frozen-lockfile
67101

68-
- name: Determine version
69-
id: version
70-
env:
71-
GITHUB_EVENT_NAME: ${{ github.event_name }}
72-
INPUT_DIST_TAG: ${{ github.event.inputs.dist-tag }}
73-
PUSH_BEFORE_SHA: ${{ github.event.before }}
74-
run: node scripts/determine-version.ts
75-
76-
# --- The dev build: every run, no conditions. ---
77-
78102
# The lockfile refresh is part of the stamp: pnpm verifies
79103
# manifests against the lockfile before running any script.
80104
- name: Stamp the dev version
81105
env:
82-
DEV_VERSION: ${{ steps.version.outputs.devVersion }}
106+
DEV_VERSION: ${{ needs.version.outputs.devVersion }}
83107
run: |
84108
node scripts/set-version.ts "$DEV_VERSION"
85109
node scripts/update-product-versions.mjs --channel dev
@@ -98,6 +122,8 @@ jobs:
98122
99123
# Never a dev build of the engine: the families peer it at an exact
100124
# release version, so a dev-stamped engine would satisfy none of them.
125+
# The dev build needs that version on npm before it publishes, and
126+
# the release job may have failed; a version already there is done.
101127
- name: Publish the engine release
102128
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true' }}
103129
env:
@@ -114,7 +140,7 @@ jobs:
114140
- name: Verify the dev version resolves
115141
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true' }}
116142
env:
117-
DEV_VERSION: ${{ steps.version.outputs.devVersion }}
143+
DEV_VERSION: ${{ needs.version.outputs.devVersion }}
118144
run: |
119145
engine=$(node -p "require('./packages/cli-engine/package.json').version")
120146
node scripts/verify-published.mjs \
@@ -129,7 +155,7 @@ jobs:
129155
continue-on-error: true
130156
timeout-minutes: 2
131157
env:
132-
DEV_VERSION: ${{ steps.version.outputs.devVersion }}
158+
DEV_VERSION: ${{ needs.version.outputs.devVersion }}
133159
run: |
134160
mkdir -p "$RUNNER_TEMP/dev-version"
135161
printf '%s\n' "$DEV_VERSION" > "$RUNNER_TEMP/dev-version/version"
@@ -146,46 +172,75 @@ jobs:
146172
overwrite: true
147173
retention-days: 7
148174

149-
# --- The release: only when the committed version changed. ---
175+
release:
176+
name: Publish the release
177+
needs: version
178+
if: ${{ needs.version.outputs.release == 'true' }}
179+
runs-on: ubuntu-latest
180+
permissions:
181+
contents: write # Required to create the GitHub Release + tag for releases
182+
id-token: write # Required for npm OIDC Trusted Publishing
183+
steps:
184+
- name: Checkout
185+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
186+
with:
187+
persist-credentials: false
150188

151-
- name: Restore the committed versions
152-
if: ${{ steps.version.outputs.release == 'true' }}
153-
run: |
154-
git checkout -- .
155-
pnpm install --frozen-lockfile
156-
pnpm build
189+
- name: Set up pnpm
190+
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
191+
192+
- name: Set up Node.js
193+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
194+
with:
195+
node-version-file: .node-version
196+
cache: pnpm
197+
198+
- name: Configure npm
199+
run: pnpm config set registry https://registry.npmjs.org
200+
201+
- name: Install dependencies
202+
run: pnpm install --frozen-lockfile
203+
204+
- name: Build
205+
run: pnpm build
157206

158207
- name: Check the release
159-
if: ${{ steps.version.outputs.release == 'true' }}
160208
env:
161209
PUBLISH_CHANNEL: release
162210
run: |
163211
pnpm check:grammar
164212
pnpm check:conformance
165213
166214
- name: Upload tarball artifacts
167-
if: ${{ steps.version.outputs.release == 'true' }}
168215
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
169216
with:
170217
name: npm-tarballs
171218
path: artifacts/tarballs/*.tgz
172219
if-no-files-found: error
173220

221+
# The release needs its engine version on npm before it publishes,
222+
# and the dev job may have failed; a version already there is done.
223+
- name: Publish the engine release
224+
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true' }}
225+
env:
226+
NPM_CONFIG_PROVENANCE: "true"
227+
run: bash scripts/publish-packages.sh latest @prisma/cli-engine
228+
174229
# NODE_AUTH_TOKEN is intentionally NOT set: npm authenticates over
175230
# OIDC, and setting it to any value — even empty — blocks that.
176231
# `pnpm publish`, not `npm publish`, or `workspace:` specifiers
177232
# survive into the published manifest.
178233
- name: Publish the release
179-
if: ${{ steps.version.outputs.release == 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }}
234+
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true' }}
180235
env:
181236
NPM_CONFIG_PROVENANCE: "true"
182-
DIST_TAG: ${{ steps.version.outputs.releaseTag }}
237+
DIST_TAG: ${{ needs.version.outputs.releaseTag }}
183238
run: bash scripts/publish-packages.sh "$DIST_TAG" @prisma/cli prisma
184239

185240
- name: Verify the release resolves
186-
if: ${{ steps.version.outputs.release == 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }}
241+
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true' }}
187242
env:
188-
RELEASE_VERSION: ${{ steps.version.outputs.releaseVersion }}
243+
RELEASE_VERSION: ${{ needs.version.outputs.releaseVersion }}
189244
run: |
190245
engine=$(node -p "require('./packages/cli-engine/package.json').version")
191246
node scripts/verify-published.mjs \
@@ -198,10 +253,10 @@ jobs:
198253
# for the id — searching the releases listing for a draft races its
199254
# eventual consistency.
200255
- name: Create GitHub Release
201-
if: ${{ steps.version.outputs.githubRelease == 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }}
256+
if: ${{ needs.version.outputs.githubRelease == 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }}
202257
env:
203258
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
204-
VERSION: ${{ steps.version.outputs.releaseVersion }}
259+
VERSION: ${{ needs.version.outputs.releaseVersion }}
205260
run: |
206261
# The by-tag endpoints do not see drafts, so search the listing.
207262
existing=$(gh api --paginate "repos/$GITHUB_REPOSITORY/releases" \

‎docs/oss/release-automation.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ A workflow step that must run should fail when its secret or token is missing, n
120120
| Two open version-update pull requests | The close-the-previous step failed | Close the older one by hand; they race each other's version and lockfile |
121121
| Checks pass but the pull request does not merge | The `main` ruleset requires one approving review, which CodeRabbit gives; it commented or was rate-limited instead | Approve the pull request by hand |
122122
| `main` holds product pins no release shipped | A release took the version number before the follow pull request merged | The next run (the daily schedule at the latest) compares `main`'s pins with the last release's tag and opens a release for them; dispatch the workflow to do it now |
123+
| A `Publish to npm` run is red at "Check the dev version" | The products' dev builds disagree with each other, for example Composer's dev build pins an ORM release while the ORM's dev build is newer | The dev build and the release are separate jobs: read the "Publish the release" job, and if it passed, the release is out. The dev build stays red until the products' dev builds agree; "Re-run failed jobs" re-runs only the dev job |
123124
| A published version never appears on the registry | npm accepted the publish but the version is not resolvable | The publish run polls for it and fails if it never appears; if that fails, re-dispatch the workflow — an already-published version is treated as done, so only the missing one publishes |
124125
| A pull request fails "prisma/cloud-deploy-action can drive this CLI" | The pull request changes the arguments `prisma deploy` accepts, and the released action does not send the new ones to this version | Release the action with a rule for this version and move its `v1` tag, then re-run the check (see [Changing the `deploy` arguments on purpose](#changing-the-deploy-arguments-on-purpose)) |
125126
| Every pull request fails "prisma/cloud-deploy-action can drive this CLI" or "Check out prisma/cloud-deploy-action" | The action's `v1` is broken, or GitHub cannot fetch `prisma/cloud-deploy-action` | Set the repository variable `CLOUD_DEPLOY_ACTION_REF` to a known-good tag of the action and re-run; delete the variable once `v1` works again. If that does not help, an administrator can bypass the `main` ruleset to merge an urgent fix |

‎docs/oss/versioning.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The npm registry exposes the CLI packages under these dist-tags:
4545

4646
- **`dev`** — every routine push to `main` publishes `<base>-dev.<run>` here automatically (operator ruling 2026-08-13, superseding the earlier "no dev channel" ruling). The suffix derives from the workflow run number and is stamped ephemerally in CI, never committed, so release versions remain exactly what a commit says. The channel exists so a product's new version reaches a working CLI without a human: every push to `main` ships a dev build. A product release goes further and cuts a real release on its own; see [release automation](./release-automation.md). Only a release for a change in this repository alone is a human act, and so is promoting any release to `latest`.
4747

48-
**Every** run of the publish workflow ships a dev build, including the one that cuts a release — the release publish is an additional half, not an alternative (operator ruling 2026-08-18). When they were alternatives, the release commit was the one merge to `main` that never reached the dev channel, so `dev` named an older version than the release until an unrelated commit landed. The dev build is published as its own version rather than by moving the `dev` tag, because OIDC trusted publishing authorises `npm publish` and nothing else. The dev channel covers `@prisma/cli` and `prisma` only. The engine has no dev builds; [Lockstep across the workspace](#lockstep-across-the-workspace) gives the reasons.
48+
**Every** run of the publish workflow ships a dev build, including the one that cuts a release — the release publish is an additional half, not an alternative (operator ruling 2026-08-18). When they were alternatives, the release commit was the one merge to `main` that never reached the dev channel, so `dev` named an older version than the release until an unrelated commit landed. The two halves run as separate jobs, so a failing dev build never holds back the release: the dev build takes the products' dev builds, which can disagree with each other while the versions a release pins are fine (on 2026-12-02 Composer's dev build pinned ORM 8.0.0-rc.26 while the ORM's dev build was 8.0.1-dev.42, and the dev check's failure stopped 8.0.0-rc.37 from publishing). The dev build is published as its own version rather than by moving the `dev` tag, because OIDC trusted publishing authorises `npm publish` and nothing else. The dev channel covers `@prisma/cli` and `prisma` only. The engine has no dev builds; [Lockstep across the workspace](#lockstep-across-the-workspace) gives the reasons.
4949

5050
The publish workflow logs in to npm through OIDC trusted publishing, which can set a tag only on the version it is publishing, never on one already on the registry, and a stored token that could re-point a tag would also be able to publish. That is why promotion uses a token added for one run; see [Procedure: promote a release to `latest`](#procedure-promote-a-release-to-latest).
5151

@@ -87,7 +87,7 @@ The release cadence is one PR per release (on the RC line: one PR per `rc.N`). A
8787
2. **Reviews and merges the PR.** This is the point where a human verifies the release is intended — merging the bump PR is the deliberate act that publishes. The resulting push to `main` carries the bumped root `version`, the publish workflow detects the change, publishes under `next`, and creates a matching GitHub Release (marked pre-release on the RC line).
8888
3. **Checks the published release and promotes it.** Install the new version from npm by its exact number and check it, together with the ORM and Composer releases it ships beside. Then move `latest` to it with [`promote.yml`](../../.github/workflows/promote.yml), as the next section describes.
8989

90-
If the publish needs to be re-run (transient registry failure, etc.), a maintainer can dispatch the [`Publish to npm`](../../.github/workflows/publish.yml) workflow from `main` with an empty `dist-tag` (or `next`) and `dry-run=false`; the workflow re-publishes the version currently committed at HEAD under `next`, and because that is the canonical tag it also re-creates the GitHub Release if it is missing. This is the same path used to cut a hand-rolled `beta` (`dist-tag=beta`, no Release).
90+
If the publish needs to be re-run (transient registry failure, etc.), a maintainer can dispatch the [`Publish to npm`](../../.github/workflows/publish.yml) workflow from `main` with an empty `dist-tag` (or `next`) and `dry-run=false`; the workflow re-publishes the version currently committed at HEAD under `next`, with the same release checks, and because that is the canonical tag it also creates the git tag and the GitHub Release if they are missing. This is the same path used to cut a hand-rolled `beta` (`dist-tag=beta`, no Release).
9191

9292
## Procedure: promote a release to `latest`
9393

@@ -118,7 +118,7 @@ The token is not a dispatch input, because dispatch inputs on a public repositor
118118

119119
## Procedure: validate publish changes
120120

121-
The publish workflow's `dry-run` mode (the input default) can be invoked from any branch to validate that the publish pipeline still works after touching `publish.yml`, `set-version.ts`, `determine-version.ts`, or the build scripts. A dry-run exercises `pnpm publish --dry-run` against both CLI packages and skips the registry publish + GitHub Release.
121+
The publish workflow's `dry-run` mode (the input default) can be invoked from any branch to validate that the publish pipeline still works after touching `publish.yml`, `set-version.ts`, `determine-version.ts`, or the build scripts. A dry run builds and checks both the dev build and the release, uploads the release tarballs, and skips every npm publish and the GitHub Release. Read the `dev` and `release` jobs' results separately: the run is red when either fails, and a failing dev build says nothing about the release.
122122

123123
The pure version-computation helpers are covered by `pnpm test:scripts` (run in CI by the PR Quality workflow), including RC-line advancement and dev-counter idempotence.
124124

0 commit comments

Comments
 (0)