mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
681940523a
Add a `preview` release type so `@preview` npm releases can be cut **ad-hoc from `canary`** via the `Trigger Release` workflow, retiring the dedicated long-lived preview branch. The GitHub environment has been updated accordingly. A preview cut produces **two commits**, pushed in a single update: 1. **Bump-to-preview** — all packages set to the computed preview version, tagged `v…-preview.N`. This tag's build publishes `@preview` (relies on #95085). 2. **Revert-to-canary** — restores the `-canary.N` versions so `canary` keeps advancing its own line and isn't stranded on a preview version. ``` B canary HEAD before cut (e.g. 16.3.0-canary.61) │ P v16.3.0-preview.N ← tag here; tag build publishes @preview │ R canary HEAD after cut (versions restored to 16.3.0-canary.61) ``` ### Preview version numbering `base = max(canary major.minor.patch, npm @preview major.minor.patch)`: - base still on the published preview line → continue it (`n + 1`) - canary advanced to a higher base (or no `@preview` published) → reset to `.0` So if `canary` jumps to `18.0.0-canary.x` since the last `16.3.0-preview.x`, the next cut is `18.0.0-preview.0`, not a continuation. ## Test plan The dry mode of `start-release.js` was extended to intercept the GH requests and log the relevant data. ```console $ node ./scripts/start-release.js --release-type preview --dry-run Dry run: keeping commits locally, skipping git push and GitHub release creation Running pnpm release-preview... [...] > lerna version 16.3.0-preview.4 --force-publish -y --no-push --allow-branch '**' [...] Creating GitHub-signed release commit(s) for v16.3.0-preview.4 from local commits 0f5c1e865cc34edb257a16823ed6525d9cd58bfc..0062348c411776271fe7eac64e97b8bad2775b77 [dry-run] GitHub API POST /repos/vercel/next.js/git/blobs [...] [dry-run] GitHub API POST /repos/vercel/next.js/git/commits {"message":"v16.3.0-preview.4","tree":"0000000000000000000000000000000000000016","parents":["0f5c1e865cc34edb257a16823ed6525d9cd58bfc"]} [dry-run] GitHub API POST /repos/vercel/next.js/git/commits {"message":"Restore canary version 16.3.0-canary.61 after v16.3.0-preview.4 preview release","tree":"000000000000000000000000000000000000002d","parents":["0000000000000000000000000000000000000017"]} [dry-run] GitHub API POST /repos/vercel/next.js/git/refs {"ref":"refs/tags/v16.3.0-preview.4","sha":"0000000000000000000000000000000000000017"} [dry-run] GitHub API PATCH /repos/vercel/next.js/git/refs/heads/sebbie/preview-release-from-canary {"sha":"000000000000000000000000000000000000002e","force":false} Dry run: skipping local branch sync; would set sebbie/preview-release-from-canary to 000000000000000000000000000000000000002e and tag v16.3.0-preview.4 at 0000000000000000000000000000000000000017 Created GitHub-signed release tag v16.3.0-preview.4 at 0000000000000000000000000000000000000017; branch sebbie/preview-release-from-canary now at 000000000000000000000000000000000000002e Dry run: skipping GitHub release creation Release process is finished ```