Repository navigation
ci(publish)!: releases publish to npm under next; a manual promotion workflow moves latest - #473
Conversation
… by the RELEASE_DIST_TAG repository variable Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…e, CLI notification and dev build; review fixes Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…est; latest moves when a maintainer promotes the release Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
… release; review fixes Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
… run without the token, and review fixes Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…TOKEN; review fixes Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…t their own queue; review nits Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
|
✅ Gizmo reviewed 3f57579 — posted 0 inline comment(s) this pass. Open findings: none Change walkthroughThis PR moves Composer releases from publishing straight to npm Workflow split (.github/workflows/promote.yml). Promotion runs as three jobs with a plan hand-off. The Scripts (scripts/promote-release.ts, scripts/promote-release-utils.ts). The planning script renames and reshapes the old Docs and tests. docs/oss/versioning.md documents the three-job flow, the per-promotion token ritual, and rollback ordering; the release skill and the dispatch-publish error message use the new workflow name consistently, with no stale |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
commit: |
There was a problem hiding this comment.
New findings: 🟡 1 minor · trace
Findings outside the diff
- 🟡 Minor · consistency docs/oss/versioning.md — Pre-existing typo in docs/oss/versioning.md trusted-publisher setup: "Repository:
compose" should becomposer
The trusted-publisher bootstrap procedure this PR rewrites around (docs/oss/versioning.md, step 2 of "One-time setup: trusted publishing", around line 141, just after the PR-edited line 136) tells maintainers to configure npm's Trusted Publisher with "Repository:compose". The repository isprisma/composer(the repo's ownpackage.jsonrepository URL and the workflow names elsewhere in the doc usecomposer), so a future package bootstrapped from this section would register a trusted publisher pointing at a nonexistent repo, and its first OIDC publish would be rejected. The line predates this PR (it is outside the PR's changed lines), but the PR edited the immediately surrounding lines, so it is a cheap fix to fold in.
Recommended fix: Change the line to "- Repository:composer".
…sitory Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…m a level promotion The docs and the publish.yml comment no longer cite prisma/prisma-cli#420: Composer and the CLI each have their own publish-then-promote change, prisma/composer#473 and a CLI pull request still to be opened. ADR 330 calls the tag step moving latest, so promotion keeps meaning a move up a level; the other docs and the skills say promotion to latest. ADR 330 records the token alternatives and no longer says releases before 8.0 went under latest, and its index row names the decision. supply-chain.md says only the token job runs from main, "Who can publish" gives the first-publish exception, and the shipped upgrade references say latest is the newest release promoted to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…e tag as data, a token job that runs no repository code, allow-downgrade Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…e plan's version, and the tag is read by its full ref Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…moves latest (#421) ## At a glance npm's dist-tags are names that point at a version; `npm install prisma` installs whatever `latest` points at. Today, merging a release PR moves `latest` at once. After this PR, it does not: ```text # Today: merging the rc.37 release PR npm dist-tag ls prisma latest: 8.0.0-rc.37 <- every `npm install prisma` gets it at once # After this PR: merging the rc.37 release PR npm dist-tag ls prisma latest: 8.0.0-rc.36 <- unchanged next: 8.0.0-rc.37 <- on npm, installable by exact version # After a maintainer checks rc.37 and runs promote.yml latest: 8.0.0-rc.37 next: 8.0.0-rc.37 ``` From this merge, every release, including the automatic ones opened when the ORM or Composer publishes, waits under `next` until a maintainer runs `promote.yml` with a short-lived npm token. ## What this PR changes - A release publishes `prisma` and `@prisma/cli` under the `next` dist-tag, not `latest`. Its checks, GitHub Release and git tag `v<version>` work as before. The GitHub Release is no longer marked "Latest". - A new manual workflow, `.github/workflows/promote.yml`, moves `latest` to a version already on npm, after checking that it is safe to. - A manual run of the publish workflow refuses `latest` as its dist-tag, so moving `latest` on `prisma` and `@prisma/cli` goes through `promote.yml` (or, as a fallback the docs describe, a person running `npm dist-tag add` with their own two-factor code). - `scripts/update-product-versions.mjs`, which opens a CLI release PR when the ORM or Composer publishes, reads their `next` tag before `latest` and takes the newer version of the two. - `@prisma/cli-engine` still publishes under `latest`, because nothing installs it by tag: every package that uses it pins an exact version. - The versioning and release docs, the READMEs, the glossary and the release skill describe the new flow. ## Before the first `promote.yml` run An admin of this repository: 1. Creates the GitHub environment `npm-promote` (Settings → Environments) and limits it to the `main` branch. An environment's secrets reach only jobs that name it, on the branches it allows. Without the branch limit, a workflow edited on any branch could name the environment and read the token. If `promote.yml` runs before the environment exists, GitHub creates it with no branch limit, so create it first. 2. For each promotion, creates a granular npm token with write access to `prisma` and `@prisma/cli` only, expiring in a day, with "Bypass two-factor authentication" ticked. They add it as the environment secret `NPM_PROMOTE_TOKEN`, run `promote.yml`, then delete the secret and revoke the token. `docs/oss/versioning.md` has the full procedure. ## Why a release no longer goes straight to `latest` A CLI release usually ships beside an ORM release and a Composer release, and pins their exact versions. Until now, each repository's release went to `latest` the moment its release PR merged. So users got each piece before anyone had installed the three together from npm and checked that they work as a set. The ORM (prisma/orm#31329) and Composer (prisma/composer#473) are making the same change. Each release reaches npm under `next`. A maintainer installs the new versions by exact number and checks them together. Then they move `latest`: ORM and Composer first, then the CLI. This PR works in either order with those two: until a product publishes a `next` tag, the CLI reads its `latest` as before. ## Publishing under `next` npm puts every published version under some dist-tag, and uses `latest` when none is given. So publishing without moving `latest` means publishing under another tag. That tag is `next`; it is not called `rc`, because the ORM's docs already use "RC" for a version's release-candidate stage. `next` was unused, and was removed from these packages on 2026-11-30; from now on every release moves it, so it stays current. `scripts/determine-version-utils.ts` returns `next` as the release tag. Nothing else in the release path of `publish.yml` depended on `latest`: `scripts/verify-published.mjs` checks exact versions. The engine is left out of the release step, because an earlier step in the same run already publishes it under `latest`. ## Moving `latest` with promote.yml `publish.yml` signs in to npm through GitHub's OIDC ("trusted publishing") and holds no token. npm lets that sign-in set a tag only on the version being published, so moving `latest` on a version already on npm needs an npm token. This repository has held no npm token, because a token that can move a tag can also publish. So the token exists only for the length of one run, as described above. `promote.yml` follows the ORM's (prisma/orm#31329), in three jobs: 1. `check` holds no token and only reads. It checks out the release's git tag `v<version>` as data, confirms the tag's commit is on `main`, and runs this workflow's own `scripts/promote-release.ts` on it. That script refuses unless: - `prisma` and `@prisma/cli` are on npm at that version; - the move does not take `latest` back to an older version, unless `allow-downgrade` is set for a rollback; - every ORM and Composer version that `prisma` and `@prisma/cli` pin at that version is exact, the same in both, and that product's `latest`. It may be older in a rollback, but never newer. This check is the CLI's own; the ORM has no such pins. For a stable version, `check` also refuses when its GitHub Release is missing or a draft. A dry run (the default) stops here, and can run from any branch. Each dry run has its own concurrency group, so it cannot replace a real promotion waiting behind a running one. 2. `promote` runs only from `main` with `dry-run` off. It is the only job that reads the token, and it checks out no code and has no access to the repository. It checks each name and version in the plan from `check`, moves `latest` for each package not already there, and says which moved if one fails, so a second run finishes the rest. 3. `mark-latest` marks a stable release's GitHub Release "Latest", so GitHub's latest release matches npm's. To roll back, run `promote.yml` with an earlier version and `allow-downgrade`. `latest` moves back; `next` still points at the withdrawn release until the next release publishes. ## The ORM and Composer pins `scripts/update-product-versions.mjs` keeps the CLI's pins on the ORM's and Composer's released versions. It used to read their `latest` tag. With their releases now waiting under `next`, reading `latest` would miss a new release until it was promoted. It would also open PRs that move pins back to the older `latest` after a CLI release had pinned the new ones. It now reads `next` and `latest` and takes the newer, so a stale `next` never moves a pin backwards. ## Tests - `scripts/determine-version-utils.test.ts`: - the release tag is `next` for RC and stable versions; - a manual publish run with `latest` is refused; - a publish under `next` counts as a release, so the GitHub Release is created. - `scripts/update-product-versions.test.mjs`: - version ordering across the version shapes the ORM and Composer publish; - `next` is taken while a release waits, and a stale `next` behind `latest` is ignored; - every package that reads a tag of its own (`@prisma/composer-cli`, `@prisma/composer`, `@prisma/orm-toolchain`) lists `next` before `latest`. - `scripts/promote-release-utils.test.ts`: each refusal (not on npm, a move back without `allow-downgrade`, a pin newer than the product's `latest` or with no `latest`, a pin older than it outside a rollback), a second run changing nothing, and a development build on `latest` not counting as a move back. - `scripts/promote-workflow.test.mjs` (as in the ORM): a dry run, or a run off `main`, gets its own concurrency group; the token stays in the `promote` job, which has no checkout and no permissions; the move step, run against a stand-in `npm`, moves only what is not already there, never writes the token to its config file, refuses a plan naming another package or a bad version, and reports a partial move. - Run by hand: - `node scripts/promote-release.ts 8.0.0-rc.36 --release-root <v8.0.0-rc.36 checkout>` plans no moves against npm today (latest is already rc.36). - `GITHUB_EVENT_NAME=push PUSH_BEFORE_SHA=<v8.0.0-rc.35> node scripts/determine-version.ts` reports `8.0.0-rc.36 under next`. - `actionlint` is clean on the changed workflows. ## Not in this PR - Nothing warns when `next` stays ahead of `latest` for a long time. That is a separate monitoring feature. ## Alternatives considered - **Check the three releases together before publishing, keeping releases on `latest`**, for example from packed tarballs in CI or a local npm registry. Rejected: the three releases come from three repositories at different times, and only the public registry shows what users will actually install, with npm's real resolution of every dependency. - **A repository variable that picks the release tag, defaulting to `latest`.** Rejected: if left set by mistake it would silently keep every later release off `latest`, and it would keep two release flows alive. - **An npm token as a `promote.yml` input.** Rejected: workflow inputs on a public repository are not treated as secrets. - **A stored npm token.** Rejected: a token that can move a tag can also publish. - **`rc` as the staging tag.** Rejected: the ORM's docs already use "RC" for a version's release-candidate stage. 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>
…moves latest (#31329) ## At a glance A release no longer moves npm's `latest` tag when it publishes. Merging a release pull request publishes every `@prisma/orm-*` package under the dist-tag `next`. A separate, manual workflow, `promote.yml`, later moves `latest` to that release. ## Why Prisma's ORM, Composer and the `prisma` CLI pin each other's exact versions, and they release one after another, hours apart. `prisma orm init` installs the ORM by package name alone, which resolves to `latest`. So as soon as an ORM release reached `latest`, every new project got an ORM that the published CLI could not run, until the matching CLI was out. With this change, `latest` moves only once all three products are published and checked together. ## What changes - **`publish.yml`**: a release push publishes under `next`, never `latest`. Every release step still runs: the committed-versions check, the release-notes check, the GitHub Release (created without GitHub's "Latest" mark), the development build of the released base, and the notification to prisma-cli. These steps now check an explicit `release` output from `scripts/determine-version.ts`, not "the tag is `latest`". A manual run with `dist-tag=latest` is refused; the recovery run uses `dist-tag=next`. - **`promote.yml`** (new, manual), in three jobs: - `check` has no token and read-only access. It runs main's scripts against the release's git tag, read as data only, and confirms the tag's commit is on `main`. It refuses to move `latest` backwards unless `allow-downgrade` is set, and outputs the plan. A dry run stops here, and can run from any branch. - `promote` runs only on `main`, in the `npm-promote` environment, with `permissions: {}`, and checks out no code. It validates the plan and moves `latest` for each package. A second run changes nothing. - `mark-latest` marks the GitHub Release as "Latest" when it is a stable release. It holds no npm token. - **The npm token.** Publishing still uses OIDC trusted publishing, but OIDC cannot move dist-tags, and npm no longer issues long-lived tokens. So for each promotion a maintainer creates a one-day granular token, puts it in the environment secret `NPM_PROMOTE_TOKEN`, runs the workflow, then deletes the secret and revokes the token. No npm token is stored between runs. - **Docs.** `docs/oss/releasing.md`, `supply-chain.md`, `versioning.md`, ADR 330 (edited in place) and the `publish-npm-version` and `draft-release-notes` skills describe the two steps. ## Order with Composer and the CLI - **prisma-cli's matching change must merge before the first ORM release under `next`** (prisma/prisma-cli#421). On prisma-cli's `main`, the version-follow still reads only `latest`. So if an ORM release published under `next` first, the CLI would pick it up only after `latest` moved: the reverse of the intended order. - **Composer's change (prisma/composer#473) must merge before the first promotion to `latest`.** ## Before the first promotion A repository admin creates the `npm-promote` environment and limits its deployment branches to `main`. Without that rule, a workflow on another branch could read the token while it sits in the environment. A required reviewer is optional. ## Status The first release to use this is 8.0.0-rc.26 (#31327). Agent: eddievanhalen-79 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Release Management** * Releases are published under the `next` tag first. After Prisma ORM, Composer, and Prisma CLI releases are checked together, they can be promoted to `latest`. * Added a promotion workflow with dry-run planning, package availability checks, and safeguards against unintended downgrades. Downgrades require explicit approval. * Publishing directly under `latest` is refused. Development builds continue to use the `dev` tag, and `next` tracks releases before promotion. * **Documentation** * Updated release, versioning, supply-chain, and upgrade guidance to explain the publishing and promotion process and when to use `next` or `latest`. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- 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>
Merging a release PR now publishes the release to npm under the dist-tag
next, notlatest.npm install @prisma/composergets the release only after a maintainer runs the new Promote a release to latest workflow. Promotion refuses until the Prisma ORM version the release pins is already the ORM'slatest. Each promotion needs a short-lived npm token, which the maintainer creates and revokes by hand, because npm trusted publishing cannot move tags.Merging this PR publishes nothing. The next release, Composer 0.41.0, is the first under
next.Why
Prisma ORM, Composer and the
prismaCLI pin each other's exact versions. Today a release goes straight tolatest, so users can install a Composer release before the ORM and CLI it was built with are published, or before anyone has checked the three together. We want to publish all three, check them together as published packages, and then movelateston all of them: ORM first, then Composer, then the CLI. The ORM and CLI repositories are making the same change, with the same tag, workflow and secret names.What changes
Publishing (
publish.yml). Merging a release PR (one that changes the rootpackage.jsonversion) publishes the release undernextand never toucheslatest. The rest of a release is unchanged:<version>-dev.1build underdevthat every push tomainpublishes.A manual run of the publish workflow now defaults to
nextand refuseslatestanddev. Its use is re-publishing a release whose publish failed.Promotion (
promote.yml, new). A manual workflow, following the pattern of prisma/orm#31329. It takes a version, is a dry run unless you switch that off, and refuses to movelatestback to an older release unlessallow-downgradeis set. It runs in three jobs, so that the npm token meets no code from the repository and no repository write access:scripts/promote-release.tsfrom the workflow's own ref against the release's tag, which it checks out as data only, and writes a plan. A dry run ends here. It refuses unless:main, and the tag's commit is onmain;@prisma/composer,@prisma/composer-cli,@prisma/composer-prisma-cloud) have the version on npm;latest, so users never get Composer with an ORM it was not released with (the CLI's promotion does the same for the versions it pins).main. It holds the token, has no repository permissions and checks out nothing. It checks each name and version in the plan, then moveslateston each package, skipping any already there, so a second run is harmless and a run that failed partway finishes when re-run.Composer differs from the ORM where its packages do: they all share one version, and the package list comes from
packages/9-public/at the release's tag, the only place publishable packages live. It keeps the ORM-pin check above, and dry runs from a branch get their own queue so they cannot push out a real promotion waiting to run.The npm token. The repository keeps none. For each promotion the maintainer:
NPM_PROMOTE_TOKENof the GitHub environmentnpm-promote;The token reaches npm only through an environment variable, never on a command line, in a file or in the log.
Docs.
docs/oss/versioning.mdcovers thenext→latestflow, promotion, rollback (allow-downgrade, after moving the ORM'slatestback) and the one-time setup. It now says Composer publishes three packages, not two. The release skill (skills-contrib/publish-npm-version) says merging publishes undernext.Before merging
npm-promoteenvironment (repository admin): Settings → Environments →npm-promote, deployment branches limited tomain, optionally a required reviewer. The branch rule is what stops a workflow on another branch from reading the token while it is there. The workflow cannot create this rule itself; if a promotion ran before the environment existed, GitHub would create it without the rule.next. prisma-cli'supdate-product-versionsreads onlylatesttoday. ci(release)!: a release publishes under next, and a manual promotion moves latest prisma-cli#421 changes it to readnextfirst. Merging this before feat(core): the app's root is written with appRoot() #421 is safe: until feat(core): the app's root is written with appRoot() #421 merges, prisma-cli picks up a Composer release when it is promoted, as it does today. In this coordinated release the CLI pins Composer 0.41.0 in its own release PR, so nothing waits on the notification.Alternatives considered
latest. Rejected: the tag would depend on a setting outside the commit, and forgetting to reset it would send the next release to the wrong tag.rc. Rejected: in Prisma ORM's docsrcalready means the Release Candidate maturity level.nexthas no other meaning, and every release moves it, so it cannot go stale. docs(versioning): retire the prisma@next tag; install plain prisma prisma-cli#415 removed the CLI'snexttag because nothing moved it and it fell 26 releases behind; feat(core): the app's root is written with appRoot() #421 brings it back on that basis.Testing
scripts/determine-version-utils.test.ts,scripts/promote-release-utils.test.ts.0.40.0passes: every package'slatestis already 0.40.0.0.39.0, read from its tag, is refused because it pins ORM8.0.0-rc.23while the ORM'slatestis8.0.0-rc.25;0.41is refused as not a release version.latest. The first real run will be Composer 0.41.0.Agent: herodotus-23
🤖 Generated with Claude Code