diff --git a/.drive/deferred.md b/.drive/deferred.md index 8f9374a0b..33e0300ff 100644 --- a/.drive/deferred.md +++ b/.drive/deferred.md @@ -333,6 +333,7 @@ Each needs a change to the Prisma Cloud Management API. ## Later Composer work +- **The publishable-location lint does not check every workspace member.** `scripts/lint-publishable-location.mjs` lists manifests by path globs that leave out `website/`, which is in the pnpm workspace. The promotion workflow takes its package list from `packages/9-public/` at the release's tag, and the publish workflow publishes every non-private workspace member. If `website/` ever became publishable, publish would ship it, promotion would leave it out, and the lint would not notice. Nothing is wrong today: `website/` is private. Fix by having the lint list members the way `publish-packages.mjs` does (`pnpm list -r`). - **Destroying production deletes the operator's platform variables.** Destroying an app's production environment deletes its Prisma Cloud project, and with it every variable the operator set. The platform never returns a value, so an operator who kept no copy must make a new secret. Options: keep the project when it holds rows that are not Composer's, or warn before deleting. Needs its own decision about destroy. - **An author-declared per-reader variable**, one that maps to the service scope the platform is expected to add, so that two readers of one name are guaranteed different values. Not built: where a value lives is the operator's choice on the platform, and nobody has a case that needs the author to force it. Wait for a real case. - **A warning when the app names a variable another module expects under a different name.** Not needed: the deploy report lists every name with its readers, so a module wired to the wrong name shows up there. diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml new file mode 100644 index 000000000..c8c536b47 --- /dev/null +++ b/.github/workflows/promote.yml @@ -0,0 +1,203 @@ +name: Promote a release to latest + +# A release is published under the `next` dist-tag (publish.yml); a bare +# install resolves `latest`. This workflow moves `latest` to a published +# release, by hand, once the Prisma ORM, Composer and prisma CLI versions that +# work together are all released and checked. See docs/oss/versioning.md. +# +# Three jobs, so that the npm token meets no code from the repository and no +# repository write access: +# - check: no npm token, read-only. Runs this workflow's own scripts on the +# release's tag, checked out as data only, and outputs what to move. A dry +# run ends here, from any branch. +# - promote: main only, not a dry run. Holds the token from the npm-promote +# environment, checks out nothing, and has no repository permissions. +# - mark-latest: marks the GitHub Release as Latest. Holds no npm token. + +on: + workflow_dispatch: + inputs: + version: + description: "Release version to promote, such as 0.41.0" + required: true + type: string + dry-run: + description: "Dry run: check the release and print the moves, without changing any tag" + required: false + default: true + type: boolean + allow-downgrade: + description: "Allow moving latest back to an older release (a rollback)" + required: false + default: false + type: boolean + +# A dry run from a branch gets its own group, so it cannot cancel a real +# promotion waiting in the queue. +concurrency: + group: ${{ github.ref == 'refs/heads/main' && 'npm-promote' || format('npm-promote-{0}', github.ref) }} + cancel-in-progress: false + +permissions: {} + +jobs: + check: + name: Check the release + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + plan: ${{ steps.plan.outputs.plan }} + + steps: + - name: Check the inputs + env: + VERSION: ${{ inputs.version }} + DRY_RUN: ${{ inputs.dry-run }} + run: | + if ! printf '%s' "$VERSION" | grep -Eq '^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'; then + echo "::error::\"$VERSION\" is not a release version, such as 0.41.0." + exit 1 + fi + if [ "$DRY_RUN" != "true" ] && [ "$GITHUB_REF" != "refs/heads/main" ]; then + echo "::error::A real promotion runs only from main. Run from $GITHUB_REF as a dry run, or dispatch from main." + exit 1 + fi + + - name: Checkout this workflow's ref + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 0 + persist-credentials: false + + # Data only: nothing in this folder is run. + - name: Checkout the release's tag as data + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + ref: refs/tags/v${{ inputs.version }} + path: release-data + persist-credentials: false + + - name: Check the release's tag is on main + env: + VERSION: ${{ inputs.version }} + run: | + tagged="$(git rev-parse "refs/tags/v$VERSION^{commit}")" + if [ "$(git -C release-data rev-parse HEAD)" != "$tagged" ]; then + echo "::error::The two checkouts of v$VERSION differ; the tag moved during the run." + exit 1 + fi + if ! git merge-base --is-ancestor "$tagged" origin/main; then + echo "::error::v$VERSION points at $tagged, which is not on main. Only a release published from main can be promoted." + exit 1 + fi + + - name: Check the GitHub Release exists + env: + GH_TOKEN: ${{ github.token }} + VERSION: ${{ inputs.version }} + run: gh release view "v$VERSION" --repo "$GITHUB_REPOSITORY" --json tagName > /dev/null + + # Node only: nothing else may run before the plan is written. + - name: Setup mise + uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1 + with: + cache: false + + - name: Plan the promotion + id: plan + env: + VERSION: ${{ inputs.version }} + ALLOW_DOWNGRADE: ${{ inputs.allow-downgrade }} + run: | + flags=() + if [ "$ALLOW_DOWNGRADE" = "true" ]; then flags+=(--allow-downgrade); fi + node scripts/promote-release.ts "$VERSION" --release-root release-data --plan-out "$RUNNER_TEMP/plan.json" "${flags[@]}" + echo "plan=$(jq -c . "$RUNNER_TEMP/plan.json")" >> "$GITHUB_OUTPUT" + + promote: + name: Move latest to the release + needs: check + if: ${{ github.ref == 'refs/heads/main' && !inputs.dry-run }} + runs-on: ubuntu-latest + environment: npm-promote + permissions: {} + outputs: + version: ${{ steps.move.outputs.version }} + + steps: + - name: Check the npm token + env: + NPM_TOKEN: ${{ secrets.NPM_PROMOTE_TOKEN }} + run: | + if [ -z "$NPM_TOKEN" ]; then + echo "::error::The npm-promote environment has no NPM_PROMOTE_TOKEN secret. Create a short-lived npm token, add it to that environment as NPM_PROMOTE_TOKEN, run again, then delete the secret and revoke the token. See docs/oss/versioning.md." + exit 1 + fi + echo "::add-mask::$NPM_TOKEN" + + # Runs no code from the repository: the plan comes from the check job, + # and each name and version in it is checked before use. The token + # reaches npm only through this step's environment, by a config file + # outside any checkout that refers to NODE_AUTH_TOKEN rather than + # holding it. + - name: Move latest + id: move + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_PROMOTE_TOKEN }} + PLAN: ${{ needs.check.outputs.plan }} + VERSION: ${{ inputs.version }} + run: | + set -euo pipefail + version_re='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$' + name_re='^@prisma/composer(-[a-z0-9-]+)?$' + release="$(jq -r '.version' <<<"$PLAN")" + entries="$(jq -r '.packages[] | "\(.name) \(.version)"' <<<"$PLAN")" + [[ $release =~ $version_re ]] || { echo "::error::The plan's version \"$release\" is not a release version."; exit 1; } + [ "$release" = "$VERSION" ] || { echo "::error::The plan is for $release, not the requested $VERSION."; exit 1; } + [ -n "$entries" ] || { echo "::error::The plan lists no package."; exit 1; } + while read -r name version <&3; do + [[ $name =~ $name_re ]] || { echo "::error::The plan names \"$name\", which is not one of ours."; exit 1; } + [ "$version" = "$release" ] || { echo "::error::The plan gives $name \"$version\", not the release's $release."; exit 1; } + done 3<<<"$entries" + + npmrc="$RUNNER_TEMP/promote.npmrc" + printf '%s\n' 'registry=https://registry.npmjs.org/' "//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}" > "$npmrc" + export NPM_CONFIG_USERCONFIG="$npmrc" + + while read -r name version <&3; do + if [ "$(npm view "$name@$version" version 2>/dev/null || true)" != "$version" ]; then + echo "::error::$name@$version is not on the registry. Nothing moved." + exit 1 + fi + done 3<<<"$entries" + + moved=() + while read -r name version <&3; do + if [ "$(npm view "$name" dist-tags.latest)" = "$version" ]; then + echo "$name: latest is already $version" + continue + fi + if npm dist-tag add "$name@$version" latest || npm dist-tag add "$name@$version" latest; then + moved+=("$name") + echo "$name: latest moved to $version" + else + echo "::error::Moving latest failed for $name@$version. Moved in this run: ${moved[*]:-none}. Run the workflow again to move the rest; packages already moved are left alone." + exit 1 + fi + done 3<<<"$entries" + echo "version=$release" >> "$GITHUB_OUTPUT" + + mark-latest: + name: Mark the GitHub Release as Latest + needs: promote + runs-on: ubuntu-latest + permissions: + contents: write + steps: + # publish.yml creates the GitHub Release without the Latest mark. + - name: Mark the GitHub Release as Latest + env: + GH_TOKEN: ${{ github.token }} + VERSION: ${{ needs.promote.outputs.version }} + run: gh release edit "v$VERSION" --repo "$GITHUB_REPOSITORY" --latest diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b467c5b8e..53ec810c9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,13 +9,16 @@ name: Publish to npm # - push to `main` with the root `version` unchanged → publish `-dev.N` # under dist-tag `dev`. # - push to `main` with the root `version` changed → publish `` under -# dist-tag `latest` and create a GitHub Release. This is how a merged -# release-bump PR auto-ships. The same run then publishes `-dev.N` +# dist-tag `next` and create a GitHub Release. This is how a merged +# release-bump PR publishes a release. It never moves `latest`: a +# maintainer promotes the release to `latest` later +# (docs/oss/versioning.md). The same run then publishes `-dev.N` # under `dev`, so every push to `main` — release or not — leaves the `dev` # dist-tag on a build of that commit. When releases skipped the dev # publish, `dev` sat on the previous base until the next routine push. # - workflow_dispatch → publish `` under the chosen dist-tag (default -# `latest`); also the dry-run path. +# `next`; `latest` and `dev` are refused); also the dry-run path. A run under +# `next` re-publishes a release whose publish failed, and counts as a release. on: push: @@ -24,9 +27,9 @@ on: workflow_dispatch: inputs: dist-tag: - description: "npm dist-tag (e.g., latest, dev, beta)" + description: "npm dist-tag: next re-publishes a release whose publish failed (latest and dev are refused)" required: true - default: "latest" + default: "next" type: string dry-run: description: "Dry-run only (build + pack + gate, no npm publish, no GitHub Release)." @@ -48,7 +51,7 @@ jobs: # dry-run path performs no registry writes and skips the GitHub Release step. if: ${{ github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry-run == 'true') }} permissions: - contents: write # Required to create the GitHub Release + tag for stable publishes + contents: write # Required to create the GitHub Release and git tags id-token: write # Required for npm OIDC Trusted Publishing steps: @@ -56,7 +59,7 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: # determine-version.ts compares the root `package.json` version at - # `github.event.before` to HEAD to decide dev vs latest; a multi-commit + # `github.event.before` to HEAD to decide dev vs release; a multi-commit # push can place `before` arbitrarily far back, so fetch full history. fetch-depth: 0 @@ -135,10 +138,11 @@ jobs: NPM_CONFIG_PROVENANCE: "true" run: node scripts/publish-packages.mjs --tag "${{ steps.version.outputs.tag }}" - # Lightweight git tag for non-stable publishes (dev / beta). Stable publishes - # get a tag via `gh release create` below. Idempotent: skip if v$VERSION exists. - - name: Create lightweight git tag for non-stable publishes - if: ${{ steps.version.outputs.tag != 'latest' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }} + # Lightweight git tag for publishes that are not releases (a manual run + # under a tag such as `beta`). Releases get their tag from + # `gh release create` below. Idempotent: skip if v$VERSION exists. + - name: Create lightweight git tag for publishes that are not releases + if: ${{ steps.version.outputs.release != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} VERSION: ${{ steps.version.outputs.version }} @@ -152,11 +156,13 @@ jobs: -f "sha=$GITHUB_SHA" fi - # Emit a GitHub Release for stable publishes only (dist-tag `latest`). - # Notes are auto-generated from the commits/PRs since the previous tag. + # Emit a GitHub Release for releases: a release-bump push, or a manual + # run under `next`. Notes are auto-generated from the commits/PRs since + # the previous tag. `--latest=false`: GitHub marks it its latest release + # when promote.yml moves npm `latest`. # Idempotent on rerun: edit an existing Release rather than re-create it. - - name: Create GitHub Release for stable publishes - if: ${{ steps.version.outputs.tag == 'latest' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }} + - name: Create GitHub Release + if: ${{ steps.version.outputs.release == 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} VERSION: ${{ steps.version.outputs.version }} @@ -169,16 +175,17 @@ jobs: gh release create "v$VERSION" \ --target "$GITHUB_SHA" \ --title "v$VERSION" \ + --latest=false \ --generate-notes fi # Tell prisma-cli a release shipped so its update-product-versions # workflow can open the repin PR now instead of at its daily run - # (prisma-cli docs/oss/release-automation.md). Stable publishes only: - # the receiver re-reads the registry at the release dist-tag, so a dev - # publish would be a no-op there. Never fails the publish. + # (prisma-cli docs/oss/release-automation.md). Releases only: the + # receiver reads each product's `next` tag first, so it finds this + # release; a dev publish would be a no-op there. Never fails the publish. - name: Notify prisma-cli - if: ${{ steps.version.outputs.tag == 'latest' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }} + if: ${{ steps.version.outputs.release == 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run != 'true') }} continue-on-error: true env: GH_TOKEN: ${{ secrets.DEPLOY_GITHUB_TOKEN }} diff --git a/docs/oss/versioning.md b/docs/oss/versioning.md index 145b92e4f..f6ee8730b 100644 --- a/docs/oss/versioning.md +++ b/docs/oss/versioning.md @@ -27,10 +27,7 @@ Every workspace package — publishable, private, and the workspace root — car same `version`. One read of root `package.json` answers "what version is this code?" for the entire repository. -- The two published packages (`@prisma/composer` and `@prisma/composer-prisma-cloud` - — the only publishable packages, both under `packages/9-public/`, ADR-0027) - publish at the same version, and each pins its workspace siblings to that - **exact** version. +- The published packages (`@prisma/composer`, `@prisma/composer-cli` and `@prisma/composer-prisma-cloud` — the only publishable packages, all under `packages/9-public/`, ADR-0027) publish at the same version, and each pins its workspace siblings to that **exact** version. - Private packages (the `@internal/*` workspace packages, build config, examples, tests) are never published but still version in lockstep, so a contributor cloning any commit sees one consistent answer. `pnpm publish` skips them via @@ -42,12 +39,9 @@ building on a false assumption. ## Dist-tag convention -- **`latest`** — the most recent stable release; the default for `npm install - @prisma/composer`. New `latest` releases happen automatically when a release PR merges - (see procedure below). -- **`dev`** — every push to `main` that doesn't change the root `version` produces a - `-dev.N` tarball under this tag. **No stability promise** — may be yanked freely. -- **`beta`** — reserved for hand-cut release candidates via `workflow_dispatch`. +- **`latest`** — the most recent stable release; the default for `npm install @prisma/composer`. A release reaches `latest` only when a maintainer promotes it (see [Promote a release to `latest`](#promote-a-release-to-latest)). Merging a release PR never moves it. +- **`next`** — every release, as soon as its release PR merges, so it always names the newest release. A release waits here until it is promoted, for example while Composer, Prisma ORM and the `prisma` CLI are checked together on their published versions. +- **`dev`** — a `-dev.N` build of every push to `main`, release or not. **No stability promise** — may be yanked freely. ## Who can publish @@ -59,9 +53,8 @@ building on a false assumption. [npm provenance attestation](https://docs.npmjs.com/generating-provenance-statements) tying it to this repository and the workflow run that produced it (provenance requires the repo to be public, which it is). -- The workflow only produces a real publish from `main`. Dry-runs are permitted from any - branch via `workflow_dispatch` (see below); every step that mutates external state is - independently guarded. +- Moving `latest` needs an npm token, because trusted publishing does not cover `npm dist-tag`. The [`Promote a release to latest`](../../.github/workflows/promote.yml) workflow reads a short-lived, package-limited token from the `npm-promote` environment, which holds it only for the length of a promotion (see [Promote a release to `latest`](#promote-a-release-to-latest)). +- The `Publish to npm` workflow only produces a real publish from `main`. Its dry-runs are permitted from any branch via `workflow_dispatch` (see below); every step that mutates external state is independently guarded. The `Promote a release to latest` workflow likewise moves `latest` only from `main`. ## Mechanism: how we deliver the contract @@ -74,10 +67,7 @@ override the version and no separate release-manifest file. invocation walks every workspace `package.json`, writes the requested version, and rewrites internal `workspace:` deps to `workspace:` (which pnpm turns into an exact `X.Y.Z` pin at publish time). -- [`scripts/determine-version.ts`](../../scripts/determine-version.ts) composes the - version + dist-tag for a run: a push to `main` whose root `version` differs from the - previous tip is a **release bump** → publish `` under `latest` + a GitHub - Release; otherwise → `-dev.N` under `dev`. +- [`scripts/determine-version.ts`](../../scripts/determine-version.ts) composes the version + dist-tag for a run: a push to `main` whose root `version` differs from the previous tip is a **release bump** → publish `` under `next` + a GitHub Release + a `-dev.N` build under `dev`; otherwise → `-dev.N` under `dev`. - [`scripts/check-publish-deps.mjs`](../../scripts/check-publish-deps.mjs) is a pre-publish gate: it packs every publishable tarball and fails the publish if any resolved `package.json` would carry a `workspace:` / `catalog:` specifier or a @@ -93,17 +83,37 @@ publish trigger** — there is no separate dispatch step for a normal release. ## Procedure: cut the next minor -1. From a clean `main`, run **`pnpm bump-minor`** in a fresh branch. It reads the root - version at `HEAD`, computes the next minor (`0.1.0` → `0.2.0`), stamps every - workspace `package.json`, and regenerates `pnpm-lock.yaml` (CI installs with - `--frozen-lockfile`, so a bump committed without the lockfile fails every job). +1. From a clean `main`, run **`pnpm bump-minor`** in a fresh branch. It reads the root version at `HEAD`, computes the next minor (`0.1.0` → `0.2.0`), stamps every workspace `package.json`, and regenerates `pnpm-lock.yaml` (CI installs with `--frozen-lockfile`, so a bump committed without the lockfile fails every job). 2. Open a PR titled `chore(release): v`. CI runs normally. -3. **Merge it.** The push to `main` changes the root version, so the `Publish to npm` - workflow recognises a release bump, publishes every package at `` under - `latest`, and cuts a GitHub Release with auto-generated notes. +3. **Merge it.** The push to `main` changes the root version, so the `Publish to npm` workflow recognises a release bump. It publishes every package at `` under `next`, cuts a GitHub Release with auto-generated notes, notifies prisma-cli (whose `update-product-versions` workflow reads Composer's `next` tag first), and publishes a `-dev.1` build under `dev`. +4. **Promote it** when users should get it: see [Promote a release to `latest`](#promote-a-release-to-latest). -Between releases, every merge to `main` publishes a `-dev.N` build under `dev` — -useful for `npm install @prisma/composer@dev` reproductions. +If a release's publish fails, re-run the failed workflow run. If that is not possible, run **Actions → Publish to npm → Run workflow** from `main` with the dist-tag `next` and dry-run unchecked: it re-publishes the release under `next` and skips packages already on npm. Manual runs refuse `latest` and `dev`. + +Between releases, every merge to `main` publishes a `-dev.N` build under `dev` — useful for `npm install @prisma/composer@dev` reproductions. + +## Promote a release to `latest` + +The [`Promote a release to latest`](../../.github/workflows/promote.yml) workflow moves `latest` to a published release on every package the release published (the packages in `packages/9-public/` at the release's tag). It runs in three jobs, so that the npm token meets no code from the repository and no repository write access: + +- **check** holds no npm token and can only read. It runs [`scripts/promote-release.ts`](../../scripts/promote-release.ts) from the workflow's own ref against the release's tag, `v`, which it checks out as data only. A dry run ends here, and may come from a branch, to try a change to the workflow. It refuses unless: + - a real run is on `main`; + - the tag's commit is on `main`, and the release's GitHub Release exists; + - every package has the version on npm; + - every Prisma ORM version the release pins is already the ORM's `latest`. If it is not, move the ORM's `latest` to the pinned version first; + - no package's `latest` would move back to an older release, unless the run sets `allow-downgrade`. +- **promote** runs only on a real run from `main`. It holds the token, has no repository permissions and checks out nothing: it moves `latest` for each package in the plan the check job wrote, after checking each name and version in it. Packages already on the version are left alone, so a second run is harmless, and a run that failed partway finishes when re-run. +- **mark-latest** gives the release's GitHub Release GitHub's "Latest" mark. It holds no npm token. + +npm trusted publishing covers `npm publish` only, not `npm dist-tag`, so a real run needs an npm token. The repository keeps none between promotions. Before the first promotion, do the [one-time setup](#one-time-setup-the-npm-promote-environment-maintainers). Then: + +1. Run the checks with a dry run, which needs no token: `gh workflow run promote.yml -R prisma/composer --ref main -f version=`. Its log lists the packages and the ORM pins it compared. +2. On npmjs.com, create a **granular access token** with read and write access to the packages the dry run listed and nothing else, the shortest expiry npm allows, and **Bypass two-factor authentication** ticked (without it, `npm dist-tag add` in CI fails asking for a one-time password). +3. Add it to the `npm-promote` environment: `gh secret set NPM_PROMOTE_TOKEN --env npm-promote -R prisma/composer`. It prompts for the value, so the token is not on your command line or in your shell history. +4. Run the promotion: `gh workflow run promote.yml -R prisma/composer --ref main -f version= -f dry-run=false`. +5. As soon as the run finishes, delete the secret (`gh secret delete NPM_PROMOTE_TOKEN --env npm-promote -R prisma/composer`) and revoke the token on npmjs.com. + +Rolling `latest` back to an older Composer release works the same way, with `-f allow-downgrade=true`. The ORM check still refuses it while the ORM's `latest` is newer than the ORM version that release pins: move the ORM's `latest` back to that version first, then promote. Moving Composer's `latest` back by hand (`npm dist-tag add @ latest`, for each package) is a last resort: `@prisma/composer-prisma-cloud` takes the ORM as an exact peer dependency, so installing it and the ORM both at `latest` then fails, and GitHub's "Latest" mark stays on the newer release until you move it (`gh release edit v --latest`). ## Validating publish changes @@ -119,19 +129,26 @@ cannot publish the initial version of a package via OIDC** — the package must exist before you can enable a trusted publisher (unlike PyPI). So the first release is a one-time manual bootstrap; every release after that goes through the workflow: -_Completed 2026-07-12 for both packages; kept as the procedure for any future +_Completed 2026-07-12 for the packages published then; kept as the procedure for any future package (e.g. a new `@prisma/composer-`)._ 1. **Create the package once, with a token.** On a machine logged in to npm as a user with publish rights to the `@prisma` scope: `pnpm install && pnpm build`, then `node scripts/publish-packages.mjs --tag latest`. This publishes the - publishable packages (the two in `packages/9-public/`) at the current root + publishable packages (those in `packages/9-public/`) at the current root version with correct exact-pinned deps. 2. **Configure a trusted publisher on each published package** at `npmjs.com/package//access` → *Trusted Publisher* → GitHub Actions: - Organization or user: `prisma` - - Repository: `compose` + - Repository: `composer` - Workflow filename: `publish.yml` - Environment: leave blank - Allowed action: **npm publish** 3. From then on, remove any token you used and let the workflow publish via OIDC. + +## One-time setup: the `npm-promote` environment (maintainers) + +Do this before the first promotion. Only a repository admin can. + +1. Create the environment: **Settings → Environments → New environment**, named `npm-promote`. Under **Deployment branches and tags**, allow only `main`: while the token is in the environment, this is what stops a workflow on another branch from reading it. Optionally add a required reviewer, so each promotion waits for an approval. The environment holds no secret between promotions. +2. Check each published package's **Settings → Publishing access** on npmjs.com. If it disallows tokens, the promotion's `npm dist-tag add` fails, and a maintainer moves `latest` by hand instead (`npm dist-tag add @ latest`, for each package). diff --git a/scripts/determine-version-utils.test.ts b/scripts/determine-version-utils.test.ts index 97cab0203..2375cfcd2 100644 --- a/scripts/determine-version-utils.test.ts +++ b/scripts/determine-version-utils.test.ts @@ -5,6 +5,7 @@ import { computeNextMinor, nextDevVersion, parseVersion, + planDispatchPublish, planPushPublish, } from './determine-version-utils.ts'; @@ -84,21 +85,28 @@ describe('planPushPublish', () => { it('publishes a dev build when the root version is unchanged', () => { assert.deepEqual( planPushPublish('0.8.0', { available: true, version: '0.8.0' }, '0.8.0-dev.4'), - { version: '0.8.0-dev.5', tag: 'dev' }, + { version: '0.8.0-dev.5', tag: 'dev', release: false }, ); }); - it('publishes a release plus a dev follow-up when the root version changed', () => { + it('publishes a release under next plus a dev follow-up when the root version changed', () => { assert.deepEqual( planPushPublish('0.9.0', { available: true, version: '0.8.0' }, '0.8.0-dev.7'), - { version: '0.9.0', tag: 'latest', devVersion: '0.9.0-dev.1' }, + { version: '0.9.0', tag: 'next', release: true, devVersion: '0.9.0-dev.1' }, ); }); it('continues the dev counter on a release rerun whose dev build already landed', () => { assert.deepEqual( planPushPublish('0.9.0', { available: true, version: '0.8.0' }, '0.9.0-dev.1'), - { version: '0.9.0', tag: 'latest', devVersion: '0.9.0-dev.2' }, + { version: '0.9.0', tag: 'next', release: true, devVersion: '0.9.0-dev.2' }, + ); + }); + + it('keeps a dev build on dev after a release on the same base', () => { + assert.deepEqual( + planPushPublish('0.9.0', { available: true, version: '0.9.0' }, '0.9.0-dev.1'), + { version: '0.9.0-dev.2', tag: 'dev', release: false }, ); }); @@ -106,14 +114,44 @@ describe('planPushPublish', () => { assert.deepEqual(planPushPublish('0.9.0', { available: false }, '0.8.0-dev.7'), { version: '0.9.0-dev.1', tag: 'dev', + release: false, }); }); it('treats a previous package.json without a version as a release bump', () => { assert.deepEqual(planPushPublish('0.9.0', { available: true, version: undefined }, undefined), { version: '0.9.0', - tag: 'latest', + tag: 'next', + release: true, devVersion: '0.9.0-dev.1', }); }); }); + +describe('planDispatchPublish', () => { + it('re-publishes a release under next when the input is blank', () => { + for (const input of [undefined, '', ' ']) { + assert.deepEqual(planDispatchPublish('0.9.0', input), { + version: '0.9.0', + tag: 'next', + release: true, + }); + } + }); + + it('publishes under another tag without counting as a release', () => { + assert.deepEqual(planDispatchPublish('0.9.0', 'beta'), { + version: '0.9.0', + tag: 'beta', + release: false, + }); + }); + + it('refuses latest, which only promotion moves', () => { + assert.throws(() => planDispatchPublish('0.9.0', 'latest'), /cannot publish under "latest"/); + }); + + it('refuses dev, which holds dev builds', () => { + assert.throws(() => planDispatchPublish('0.9.0', 'dev'), /cannot publish under "dev"/); + }); +}); diff --git a/scripts/determine-version-utils.ts b/scripts/determine-version-utils.ts index 5080beef4..e14416343 100644 --- a/scripts/determine-version-utils.ts +++ b/scripts/determine-version-utils.ts @@ -65,28 +65,57 @@ export type PreviousVersionLookup = | { available: true; version: string | undefined } | { available: false }; -export interface PushPublishPlan { +export interface PublishPlan { version: string; - tag: 'latest' | 'dev'; + tag: string; + release: boolean; devVersion?: string; } +/** + * Every release publishes under this dist-tag and never moves `latest`. + * `latest` moves only when a maintainer promotes a published release. + */ +export const RELEASE_DIST_TAG = 'next'; + +/** + * The publish plan for a manual run: `` under the input tag, or + * `next` when blank. A run under `next` re-publishes a release whose publish + * failed, so it counts as a release. `latest` is refused because promotion + * is how `latest` moves; `dev` is refused because a release version under + * `dev` would sit where dev builds belong. + */ +export function planDispatchPublish(base: string, input: string | undefined): PublishPlan { + const tag = input?.trim() || RELEASE_DIST_TAG; + if (tag === 'latest' || tag === 'dev') { + throw new Error( + `A manual publish run cannot publish under "${tag}". Re-publish a release under "next", and promote it to "latest" with the Promote a release to latest workflow (docs/oss/versioning.md).`, + ); + } + return { version: base, tag, release: tag === RELEASE_DIST_TAG }; +} + /** * The publish plan for a push to `main`. A changed root version means - * the push is a release bump: publish `` under `latest`, plus a + * the push is a release bump: publish `` under `next`, plus a * `-dev.N` follow-up so the `dev` dist-tag never falls behind - * `latest`. An unchanged (or unreadable — a transient git error must - * never silently promote to `latest`) previous version means the usual + * the release. An unchanged (or unreadable — a transient git error must + * never silently publish a release) previous version means the usual * dev-only publish. */ export function planPushPublish( base: string, previous: PreviousVersionLookup, latestDevTag: string | undefined, -): PushPublishPlan { +): PublishPlan { const isReleaseBump = previous.available && previous.version !== base; if (isReleaseBump) { - return { version: base, tag: 'latest', devVersion: nextDevVersion(base, latestDevTag) }; + return { + version: base, + tag: RELEASE_DIST_TAG, + release: true, + devVersion: nextDevVersion(base, latestDevTag), + }; } - return { version: nextDevVersion(base, latestDevTag), tag: 'dev' }; + return { version: nextDevVersion(base, latestDevTag), tag: 'dev', release: false }; } diff --git a/scripts/determine-version.ts b/scripts/determine-version.ts index ee88e5225..5ac1d3dfb 100644 --- a/scripts/determine-version.ts +++ b/scripts/determine-version.ts @@ -9,23 +9,26 @@ * appropriate to the GitHub event: * * - `push` → if the root `version` changed in this push, - * `` (no suffix), dist-tag `latest`. This + * `` (no suffix), dist-tag `next`. This * is how a merged `chore(release): ...` PR - * ships a stable release automatically. The - * plan then also carries `devVersion` - * (`-dev.N`) so the workflow can publish - * a dev build of the same commit — the `dev` - * dist-tag must never fall behind `latest`. + * publishes a release; `latest` moves later, + * when a maintainer promotes it. The plan then + * also carries `devVersion` (`-dev.N`) so + * the workflow can publish a dev build of the + * same commit — the `dev` dist-tag must never + * fall behind the release. * Otherwise, `-dev.N`, dist-tag `dev` * (N is the next available build number, * discovered by querying npm). * - `workflow_dispatch` → `` (no suffix), dist-tag from - * `INPUT_DIST_TAG` (defaults to `latest`). - * Useful as a manual escape hatch (re-publish - * after a transient failure, cut a beta). + * `INPUT_DIST_TAG` (defaults to `next`; `latest` + * and `dev` are refused). The manual escape + * hatch: re-publish a release whose publish + * failed. A run under `next` counts as a release. * - * Outputs `version`, `tag`, and `devVersion` (empty unless the push is - * a release bump) to `$GITHUB_OUTPUT` for downstream workflow steps. + * Outputs `version`, `tag`, `release` (whether the run publishes a + * release) and `devVersion` (empty unless the push is a release bump) + * to `$GITHUB_OUTPUT` for downstream workflow steps. */ import { execFileSync, execSync } from 'node:child_process'; @@ -33,13 +36,18 @@ import { appendFileSync, readFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import { dirname, join } from 'pathe'; import type { PreviousVersionLookup } from './determine-version-utils.ts'; -import { assertCanonicalBase, planPushPublish } from './determine-version-utils.ts'; +import { + assertCanonicalBase, + planDispatchPublish, + planPushPublish, +} from './determine-version-utils.ts'; const PACKAGE_NAME = process.argv[2] ?? '@prisma/composer'; interface VersionResult { version: string; tag: string; + release: boolean; devVersion?: string; } @@ -103,6 +111,7 @@ function writeGitHubOutput(result: VersionResult): void { if (outputFile) { appendFileSync(outputFile, `version< { + it('accepts a release version', () => { + assert.doesNotThrow(() => assertReleaseVersion('0.41.0')); + }); + + it('refuses dev builds, ranges and tags', () => { + for (const version of ['0.41.0-dev.1', '^0.41.0', 'next', '', 'v0.41.0']) { + assert.throws(() => assertReleaseVersion(version), /not a release version/); + } + }); +}); + +describe('planPromotion', () => { + it('moves latest on every package that has the version', () => { + assert.deepEqual( + planPromotion('0.41.0', [ + { name: 'a', hasVersion: true, latest: '0.40.0' }, + { name: 'b', hasVersion: true, latest: undefined }, + ]), + { + missing: [], + moves: [ + { name: 'a', from: '0.40.0', back: false }, + { name: 'b', from: undefined, back: false }, + ], + unchanged: [], + }, + ); + }); + + it('reports packages missing the version', () => { + assert.deepEqual( + planPromotion('0.41.0', [{ name: 'b', hasVersion: false, latest: '0.40.0' }]).missing, + ['b'], + ); + }); + + it('leaves packages already on the version alone, so a second run changes nothing', () => { + const promotion = planPromotion('0.41.0', [{ name: 'a', hasVersion: true, latest: '0.41.0' }]); + assert.deepEqual(promotion.unchanged, ['a']); + assert.deepEqual(promotion.moves, []); + }); + + it('marks a move back to an older release', () => { + assert.deepEqual( + planPromotion('0.39.0', [{ name: 'a', hasVersion: true, latest: '0.40.0' }]).moves, + [{ name: 'a', from: '0.40.0', back: true }], + ); + }); +}); + +describe('promotionPlan', () => { + it('lists every package at the release version', () => { + assert.deepEqual(promotionPlan('0.41.0', ['@prisma/composer', '@prisma/composer-cli']), { + version: '0.41.0', + packages: [ + { name: '@prisma/composer', version: '0.41.0' }, + { name: '@prisma/composer-cli', version: '0.41.0' }, + ], + }); + }); +}); + +describe('isOlderRelease', () => { + it('compares each part as a number', () => { + assert.equal(isOlderRelease('0.9.0', '0.10.0'), true); + assert.equal(isOlderRelease('0.10.0', '0.9.0'), false); + assert.equal(isOlderRelease('1.0.0', '0.99.99'), false); + assert.equal(isOlderRelease('0.41.0', '0.41.0'), false); + }); +}); + +describe('collectOrmPins', () => { + it('collects exact Prisma ORM pins from dependencies and peer dependencies, once each', () => { + assert.deepEqual( + collectOrmPins([ + { + dependencies: { '@prisma/orm-toolchain': '8.0.0-rc.26', effect: '4.1.4' }, + peerDependencies: { '@prisma/orm-postgres': '8.0.0-rc.26' }, + }, + { dependencies: { '@prisma/orm-toolchain': '8.0.0-rc.26' } }, + ]), + [ + { name: '@prisma/orm-toolchain', version: '8.0.0-rc.26' }, + { name: '@prisma/orm-postgres', version: '8.0.0-rc.26' }, + ], + ); + }); + + it('ignores ranges and packages outside the ORM', () => { + assert.deepEqual( + collectOrmPins([ + { + dependencies: { '@prisma/orm-toolchain': '^8.0.0', '@prisma/cli-engine': '0.10.4' }, + }, + {}, + ]), + [], + ); + }); +}); + +describe('ormPinsNotLatest', () => { + it('returns the pins whose package latest is elsewhere', () => { + const latest: Record = { + '@prisma/orm-toolchain': '8.0.0-rc.26', + '@prisma/orm-postgres': '8.0.0-rc.25', + }; + assert.deepEqual( + ormPinsNotLatest( + [ + { name: '@prisma/orm-toolchain', version: '8.0.0-rc.26' }, + { name: '@prisma/orm-postgres', version: '8.0.0-rc.26' }, + { name: '@prisma/orm-framework', version: '8.0.0-rc.26' }, + ], + (name) => latest[name], + ), + [ + { name: '@prisma/orm-postgres', version: '8.0.0-rc.26' }, + { name: '@prisma/orm-framework', version: '8.0.0-rc.26' }, + ], + ); + }); +}); diff --git a/scripts/promote-release-utils.ts b/scripts/promote-release-utils.ts new file mode 100644 index 000000000..50e2eff19 --- /dev/null +++ b/scripts/promote-release-utils.ts @@ -0,0 +1,96 @@ +// Pure helpers for `promote-release.ts`, exercised under `node --test` +// from `pnpm test:scripts`. All npm and file I/O lives in the caller. + +const RELEASE_VERSION_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/; +const EXACT_VERSION_PATTERN = /^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/; +const ORM_PACKAGE_PREFIX = '@prisma/orm-'; + +export function assertReleaseVersion(version: string): void { + if (!RELEASE_VERSION_PATTERN.test(version)) { + throw new Error( + `"${version}" is not a release version. Give the version of a published release, such as "0.41.0".`, + ); + } +} + +/** Whether release `a` is older than release `b` (both `major.minor.patch`). */ +export function isOlderRelease(a: string, b: string): boolean { + const [pa, pb] = [a, b].map((v) => v.split('.').map(Number)); + for (let i = 0; i < 3; i++) { + const [x, y] = [pa?.[i] ?? 0, pb?.[i] ?? 0]; + if (x !== y) return x < y; + } + return false; +} + +export interface PackageOnNpm { + name: string; + hasVersion: boolean; + latest: string | undefined; +} + +export interface Promotion { + /** Packages without the version on npm; the caller then changes nothing. */ + missing: string[]; + /** Packages whose `latest` moves to the version, with where it moves from. */ + moves: { name: string; from: string | undefined; back: boolean }[]; + /** Packages whose `latest` is already on the version. */ + unchanged: string[]; +} + +/** What promoting `version` does to each package. */ +export function planPromotion(version: string, packages: readonly PackageOnNpm[]): Promotion { + const promotion: Promotion = { missing: [], moves: [], unchanged: [] }; + for (const pkg of packages) { + if (!pkg.hasVersion) promotion.missing.push(pkg.name); + else if (pkg.latest === version) promotion.unchanged.push(pkg.name); + else { + const back = pkg.latest !== undefined && isOlderRelease(version, pkg.latest); + promotion.moves.push({ name: pkg.name, from: pkg.latest, back }); + } + } + return promotion; +} + +/** What the promote job moves: every package of the release, at its version. */ +export interface PromotionPlan { + version: string; + packages: { name: string; version: string }[]; +} + +export function promotionPlan(version: string, names: readonly string[]): PromotionPlan { + return { version, packages: names.map((name) => ({ name, version })) }; +} + +export interface PublishedManifest { + dependencies?: Record; + peerDependencies?: Record; +} + +export interface OrmPin { + name: string; + version: string; +} + +/** The exact Prisma ORM versions the published packages depend on. */ +export function collectOrmPins(manifests: readonly PublishedManifest[]): OrmPin[] { + const pins = new Map(); + for (const manifest of manifests) { + for (const deps of [manifest.dependencies, manifest.peerDependencies]) { + for (const [name, version] of Object.entries(deps ?? {})) { + if (name.startsWith(ORM_PACKAGE_PREFIX) && EXACT_VERSION_PATTERN.test(version)) { + pins.set(`${name}@${version}`, { name, version }); + } + } + } + } + return [...pins.values()]; +} + +/** The ORM pins whose package's `latest` is not on the pinned version. */ +export function ormPinsNotLatest( + pins: readonly OrmPin[], + latestOf: (name: string) => string | undefined, +): OrmPin[] { + return pins.filter((pin) => latestOf(pin.name) !== pin.version); +} diff --git a/scripts/promote-release.ts b/scripts/promote-release.ts new file mode 100644 index 000000000..f048dbcef --- /dev/null +++ b/scripts/promote-release.ts @@ -0,0 +1,170 @@ +#!/usr/bin/env node + +/** + * Checks a published release before `.github/workflows/promote.yml` moves + * `latest` to it, and writes what to move. It moves no tag and needs no + * token (docs/oss/versioning.md). + * + * Usage: node scripts/promote-release.ts [--release-root ] + * [--allow-downgrade] [--plan-out ] + * + * `--release-root` is a checkout of the release's tag, `v`, read as + * data only: its root `package.json` and the manifests in + * `packages/9-public/`, the only place publishable packages live. It + * defaults to this repository. Stops when any package is not on npm at the + * version, when a Prisma ORM version the release pins is not the ORM's + * `latest`, and when a move would take `latest` back to an older release + * unless `--allow-downgrade` is given. + */ + +import { execFileSync } from 'node:child_process'; +import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { dirname, join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { + assertReleaseVersion, + collectOrmPins, + ormPinsNotLatest, + type PackageOnNpm, + type PublishedManifest, + planPromotion, + promotionPlan, +} from './promote-release-utils.ts'; + +const USAGE = + 'Usage: node scripts/promote-release.ts [--release-root ] [--allow-downgrade] [--plan-out ]'; + +function fail(message: string, code = 1): never { + console.error(message); + process.exit(code); +} + +let version: string | undefined; +let releaseRoot = dirname(dirname(fileURLToPath(import.meta.url))); +let allowDowngrade = false; +let planOut: string | undefined; +const args = process.argv.slice(2); +for (let i = 0; i < args.length; i++) { + const arg = args[i] ?? ''; + const value = args[i + 1]; + if (arg === '--allow-downgrade') allowDowngrade = true; + else if (arg === '--release-root' && value !== undefined) { + releaseRoot = resolve(value); + i++; + } else if (arg === '--plan-out' && value !== undefined) { + planOut = resolve(value); + i++; + } else if (!arg.startsWith('--') && version === undefined) version = arg; + else fail(USAGE, 2); +} +if (version === undefined) fail(USAGE, 2); +const release: string = version; +try { + assertReleaseVersion(release); +} catch (error) { + fail(error instanceof Error ? error.message : String(error)); +} + +interface Manifest { + name?: string; + version?: string; + private?: boolean; +} + +const readJson = (file: string): Manifest => JSON.parse(readFileSync(file, 'utf-8')); + +const rootVersion = readJson(join(releaseRoot, 'package.json')).version; +if (rootVersion !== release) { + fail( + `The release data is release ${rootVersion}, not ${release}. Check out the release's tag, v${release}, as the release data, and run again.`, + ); +} + +const publicDir = join(releaseRoot, 'packages', '9-public'); +const names = readdirSync(publicDir) + .map((dir) => join(publicDir, dir, 'package.json')) + .filter((file) => existsSync(file)) + .map(readJson) + .flatMap((manifest) => (!manifest.private && manifest.name ? [manifest.name] : [])) + .sort(); +if (names.length === 0) fail(`No published package found in ${publicDir}.`); + +/** `npm view`, with `undefined` when npm has no such package or version. */ +function npmView(spec: string, ...fields: string[]): string | undefined { + try { + const out = execFileSync('npm', ['view', spec, ...fields], { + encoding: 'utf-8', + stdio: ['ignore', 'pipe', 'pipe'], + }).trim(); + return out === '' ? undefined : out; + } catch (error) { + if (error instanceof Error && 'stderr' in error && String(error.stderr).includes('E404')) { + return undefined; + } + throw error; + } +} + +const latestOf = (name: string) => npmView(name, 'dist-tags.latest'); + +const packages: PackageOnNpm[] = names.map((name) => ({ + name, + hasVersion: npmView(`${name}@${release}`, 'version') === release, + latest: latestOf(name), +})); +const promotion = planPromotion(release, packages); + +console.log(`Promoting release ${release} to latest:`); +for (const pkg of packages) console.log(` ${pkg.name}: latest is ${pkg.latest ?? '(none)'}`); + +if (promotion.missing.length > 0) { + fail(`Not promoting: ${release} is not on npm for ${promotion.missing.join(', ')}.`); +} + +// One field per call: with several fields, npm drops the field names when +// only one of them is set. +const dependencyField = (name: string, field: string): Record => + JSON.parse(npmView(`${name}@${release}`, field, '--json') ?? '{}'); +const manifests: PublishedManifest[] = names.map((name) => ({ + dependencies: dependencyField(name, 'dependencies'), + peerDependencies: dependencyField(name, 'peerDependencies'), +})); +const ormPins = collectOrmPins(manifests); +const ormLatest = new Map(ormPins.map((pin) => [pin.name, latestOf(pin.name)])); +const ormLatestOf = (name: string) => ormLatest.get(name); +for (const pin of ormPins) { + console.log( + ` ORM pin ${pin.name}@${pin.version}: latest is ${ormLatestOf(pin.name) ?? '(none)'}`, + ); +} +const ormMismatched = ormPinsNotLatest(ormPins, ormLatestOf); +if (ormMismatched.length > 0) { + const listed = ormMismatched + .map((pin) => `${pin.name}@${pin.version} (latest is ${ormLatestOf(pin.name) ?? 'unset'})`) + .join(', '); + fail( + `Not promoting: ${release} pins Prisma ORM versions that are not the ORM's latest: ${listed}. ` + + "If the ORM's latest is older, promote the ORM first. If it is newer, users would get this release with an ORM it was not released with: release Composer on that ORM, or move the ORM's latest back first.", + ); +} + +const backwards = promotion.moves.filter((move) => move.back); +if (backwards.length > 0 && !allowDowngrade) { + fail( + `Not promoting: this moves latest back to an older release for ${backwards + .map((move) => `${move.name} (latest is ${move.from})`) + .join(', ')}. Run again with allow-downgrade to roll back on purpose.`, + ); +} + +for (const name of promotion.unchanged) console.log(` ${name}: already on ${release}`); +for (const move of promotion.moves) { + console.log( + ` ${move.name}: moves latest to ${release}${move.back ? ' (back to an older release)' : ''}`, + ); +} + +if (planOut !== undefined) { + writeFileSync(planOut, `${JSON.stringify(promotionPlan(release, names))}\n`); +} diff --git a/skills-contrib/publish-npm-version/SKILL.md b/skills-contrib/publish-npm-version/SKILL.md index 17414dad8..359d788eb 100644 --- a/skills-contrib/publish-npm-version/SKILL.md +++ b/skills-contrib/publish-npm-version/SKILL.md @@ -4,9 +4,10 @@ description: >- Cuts the next minor release of Prisma Composer: bumps the root package.json version, propagates it to every workspace package in lockstep, and opens a PR titled "chore(release): v". When a maintainer - merges the PR, the `Publish to npm` workflow runs automatically and ships the - new version to npm under dist-tag `latest`, plus a matching GitHub Release - with auto-generated notes. Use when a maintainer asks to "cut the next minor", + merges the PR, the `Publish to npm` workflow runs automatically and publishes + the new version to npm under dist-tag `next`, plus a matching GitHub Release + with auto-generated notes; users get it when a maintainer promotes it to + `latest`. Use when a maintainer asks to "cut the next minor", "bump to the next version", "open a release PR", or "prepare a publish PR". --- @@ -59,9 +60,7 @@ undisturbed. gh pr create --base main --title "chore(release): v" \ --body "Release v. Merging this triggers the Publish to npm workflow." ``` -5. **Hand off.** Tell the maintainer the PR is open and that **merging it** ships - `` to npm under `latest` (via OIDC trusted publishing) and cuts a - GitHub Release with auto-generated notes. Do not merge it yourself unless asked. +5. **Hand off.** Tell the maintainer the PR is open and that **merging it** publishes `` to npm under `next` (via OIDC trusted publishing) and cuts a GitHub Release with auto-generated notes. Users get the release only once a maintainer promotes it to `latest` with the `Promote a release to latest` workflow (versioning.md § Promote a release to `latest`). Do not merge it yourself unless asked. ## What this skill does NOT do