Repository navigation
ci: add one-click release flow (3.x) - #18717
Conversation
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
DanRibbens
left a comment
There was a problem hiding this comment.
Written with AI
Requesting changes for two release-path bugs: the local fallback skips most packages using their pre-bump versions, and the CI bump cannot recognize real non-fast-forward push errors to retry.
Validation: 122 existing releaser tests passed in an isolated PR snapshot, along with targeted reproductions of both findings. The Turbo publish-order test was excluded.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
GermanJablo
left a comment
There was a problem hiding this comment.
My only observation for now: it's now easier to pick the wrong bump. The local script compared your choice with the bump the commits suggest and asked you to confirm if they differed. Now it's just a dropdown that defaults to patch. #18729 fixes this for main; maybe we should do something similar here.
@GermanJablo The process right now is to review the commits and choose the correct bump. I do think this would be a good improvement. I'll do a followup PR once your PR merges into main, so they stay consistent. |
…8796) A `release-bump` dry run shows the release notes that the real release will get, on the run summary page. This PR also ports the release-flow fixes from the 3.x port ([#18717](#18717)) and removes the local `pnpm release` script. All packages require npm trusted publishing (OIDC: npm accepts a short-lived token from the CI job in place of a stored secret). A local publish cannot authenticate, so the CI flow is the only release path. ```diff dispatch release-bump (dry_run: true) compute next version log git commands + generate release notes for base..HEAD, labeled with the next version + write notes to the run summary page review notes wrong: fix in a follow-up PR, dry run again right: dispatch release-bump (dry_run: false) ``` ```diff release-bump - push rejected by a race: fail + push rejected by a race: rebase and retry npm registry checks - 1 attempt, no timeout + 3 attempts, 15 s timeout each release-ci publish order - glob order (payload before translations) + packagePublishList order (translations before payload) -pnpm release (local publish) ``` ## Changes - **Release notes preview on dry run** - A dry run finds the changelog base tag. It generates notes for `base..HEAD`, labeled with the next version. - The notes go to the log and to `$GITHUB_STEP_SUMMARY` (the Markdown job summary on the run page). - A missing base tag fails the dry run. A real run skips the preview. - **Release notes generation** - `generateReleaseNotes` takes an optional `releaseTag`. It sets the version in the heading, compare link, and release URL. - The `chore(release): vX` commit filter applies to every range. Before, it applied to tag ranges only. - **Publish order** - `getPackageDetails` returns packages in `packagePublishList` order. CI publishes `translations` before `payload`. - **Bump push retry** - Git commands in `release-bump` run through a new `runCommand` helper. It keeps git's stderr in the thrown error. - A rejected push matches the non-fast-forward check. The bump rebases and pushes again. - **Registry reads** - `isVersionPublished` retries network errors, timeouts, 429, and 5xx responses. It makes 3 attempts with a 15 s timeout each. - **Local release script removed** - `tools/releaser/src/release.ts`, both `release` scripts, and the `prompts` dependencies are deleted. - **Cleanups** - The publish retry is a loop with the same log output. - Type guards replace the `as` casts in the draft-release code. ## Design Decisions - The preview uses the same base-tag lookup (`listReleaseTags` and `findChangelogBaseTag`) and the same notes function as `release-ci`. For the same commits, the preview has the same entries as the CI draft. - Two things can differ: the date in the heading, and commits merged after the dry run. - `release-ci` keeps its `toVersion: <tag>` call, so the publish path does not change. - The dry run fails closed. If a dry run passes, CI can produce notes. ## Overall Flow The dry run generates notes and writes the job summary. Before, it only logged the git commands. ```mermaid sequenceDiagram participant M as Maintainer participant B as release-bump participant N as npm registry participant G as GitHub M->>B: dispatch (dry_run: true) B->>B: compute next version B->>N: version published? (with retries) B->>B: find base tag, generate notes for base..HEAD B->>G: write job summary M->>B: dispatch (dry_run: false) B->>G: push release commit and tag (rebase retry) G->>G: tag starts publish-release (release-ci) ``` ## References / Links - [Adding a job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary): how `$GITHUB_STEP_SUMMARY` renders Markdown on the run page. - [npm trusted publishing](https://docs.npmjs.com/trusted-publishers): OIDC publishing from CI. 🤖 Written with AI
…ide (#18729) ## Why The bump is chosen by hand and nothing checks it. A `patch` for a release with `feat:` commits ships without any warning. ## What `bump` now defaults to `auto`, which is computed from the commits and is always `prerelease` on a prerelease line. Any other bump fails before touching git unless `override_reason` is filled in. The reason is recorded as a notice on the run. Needs porting to `3.x` once [#18717](#18717) lands. Related: PYLD-4162 Co-authored-by: German Jablonski <[email protected]>
Ports [#18796](#18796) from main to 3.x. A `release-bump` dry run now shows the release notes that the real release will get. It also removes the local `pnpm release` fallback. ```diff .github/workflows/ └── publish-release.yml # drops the [skip ci] check tools/releaser/src/ ├── release-bump.ts # dry run previews notes ├── release-ci.ts # uses listReleaseTags -├── release.ts # local release fallback ├── lib/ +│ ├── listReleaseTags.ts # lists v3.* tags +│ ├── writeStepSummary.ts # appends to the job summary -│ └── publishLocalRelease.ts └── utils/ └── generateReleaseNotes.ts # optional releaseTag ``` v3.92.0 was the first 3.x release from CI. Its dry run showed only the git commands. The notes first appeared in the draft GitHub release, after the npm publish. ## Changes - **Release notes preview on dry run** - A dry run finds the changelog base tag. It generates notes for `base..HEAD`, labeled with the next version. - The notes go to the log and to `$GITHUB_STEP_SUMMARY` (the Markdown job summary on the run page). - A missing base tag fails the dry run. A real run skips the preview. - **Release notes generation** - `generateReleaseNotes` takes an optional `releaseTag`. It sets the version in the heading, compare link, and release URL. - The `chore(release): vX` commit filter applies to every range. Before, it applied to tag ranges only. - **Shared tag listing** - `release-bump` and `release-ci` list `v3.*` tags through one `listReleaseTags` helper. - **Local release path** - Deletes `release.ts`, `publishLocalRelease`, both `release` scripts, and the `prompts` dependencies. - Drops the `[skip ci]` check from `publish-release`. The check only stopped a second publish after a local release. ## Design Decisions - **Preview only from #18796.** That PR also brought the 3.x hardening fixes to main: publish order, push rebase retry, and registry retries. 3.x already has them from [#18717](#18717). - **Local fallback removed.** The `Release tags` ruleset lets only the release bot create `v3.*` tags. A local `pnpm release` cannot push its tag. Its printed resume steps also tell the maintainer to push one. - **Same notes as CI.** The preview uses the same base-tag lookup and notes function as `release-ci`. Only the heading date and commits merged after the dry run can differ. ## Overall Flow ```diff release-bump --dry-run compute next version check next version is not on npm + find base tag (newest published v3 tag below the next version) + generate notes for base..HEAD, labeled with the next version + write notes to the log and the job summary log git commands, push nothing ``` ## References / Links - [Adding a job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary): how `$GITHUB_STEP_SUMMARY` renders Markdown on the run page. 🤖 Written with AI
This PR ports main's one-click release flow to the
3.xbranch, for stable v3patchandminorreleases. A maintainer dispatches one workflow. CI then bumps the version, tags it, publishes to npm, and opens a draft GitHub release.v3 releases today run from a maintainer's machine with
pnpm release --tag latest. After v4 reaches GA, a v3 release must not move the npmlatestdist-tag (the label a plainnpm installresolves). Choosing the tag by hand on every release is easy to get wrong.Local dry runs:
pnpm release-bump --bump minor --dry-runandGITHUB_TOKEN=$(gh auth token) pnpm release-ci --dry-run(read-only).pnpm releasestays as a guarded local fallback and refuses--tag.Required before the first run (repo settings, outside this PR):
releaseenvironment: allow tag patternv3.*.bumpenvironment: allow branch3.x.3.x-branch-governanceruleset: addpayload-release-botto the bypass list.Resolves PYLD-4381
Changes
release-bump.ymltakesbumpanddry_run. It checks out3.xand runsrelease-bump.ts.publish-release.ymlruns only on stable v3 tags (v3.*.*, excludingv3.*-*). It runsrelease-ci.tsin thereleaseenvironment.publish-release.ymlskips a tag whose commit message has[skip ci]. Only the localpnpm releasecommit carries it, and that path publishes on its own.release-bump.tsaccepts only a stable v3 version on3.xwith apatchorminorbump. It also stops if npm already has the next version.3.xduring the push, the bump rebases, retags, and pushes again.latestwhile its npmlatestis v3 or lower. It publishes topayload-3once its npmlatestis v4 or higher.latest, andpayload-3when chosen, is read again right before that package publishes.latestandpayload-3.latest.publish-releasejob on the same tag resumes the release. It skips packages already on npm and reads each tag again.publishListis in topological order (every dependency before its dependents). A spec checks the list against turbo's build graph.getPackageDetailsreturns packages in list order. It used to return them in filesystem glob order, which publishedpayloadbeforetranslations.3.x. Whenpayloadpublishes topayload-3, the draft request sendsmake_latest: false.publish-prereleasepublishes only tointernalandinternal-debug.release.ts)pnpm releasewould bump to a new version and split the release.publish-releaserun started. Only then do they runrelease-cilocally.pnpm publishper package, in list order.Design Decisions
richtext-slatekeeplatestafter v4 GA. Packages that also ship in v4 move topayload-3.--tag latestskips npm's "lower than current latest" check. npm has no such check for other tags. The releaser therefore runs its own check before each publish: no newer major onlatest, and no lower version than the tag's current version onlatestorpayload-3.latestreaches every new install.payload-3gap at GA.payload-3does not exist until the first v3 release after GA. A manual dist-tag step at GA closes the gap. CI gets no dist-tag permission.releaseenvironment's tag policy controls which tags can publish.[skip ci]check makes this explicit instead of relying on GitHub's skip handling for tag pushes.getPackageDetailsalso returns glob order. The bump push retry on main also cannot see git's rejection text. A separate PR fixes main.Overall Flow
The release moves out of a maintainer's terminal into two workflows, joined by a tag.
sequenceDiagram actor M as Maintainer participant B as release-bump.yml participant R as 3.x branch participant P as publish-release.yml participant N as npm participant G as GitHub Releases M->>B: dispatch on 3.x (bump, dry_run) B->>B: guard: 3.x, stable v3, patch/minor, not on npm B->>R: commit, tag v3.x.y, atomic push (rebase and retry if 3.x moved) R-->>P: tag push triggers publish P->>N: read dist-tags for every package P->>P: build loop each package in topological order P->>N: re-read dist-tags (retry transient errors), guard P->>N: publish --tag latest or payload-3 end P->>G: upsert draft release (target 3.x) M->>G: review and publish draftReferences / Links
make_lateston create and update.🤖 Written with AI