From 5528e4339d2dbcbbaee3197282a8308f3487fd65 Mon Sep 17 00:00:00 2001 From: Joichiro Hayashi Date: Fri, 25 Sep 2026 08:43:58 +0900 Subject: [PATCH] chore(release): take the release PR body as a file in bump-version - pass the other options to bumpp - document the release steps in AGENTS.md --- AGENTS.md | 16 ++++++++++++++++ scripts/bump-version.sh | 26 ++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index bc9a4ae..80d22cb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,6 +42,22 @@ Commit or amend only on an explicit go-ahead. Draft the message, show it, and wa Never push, and never open a PR. I do both myself, opening the PR from the web UI. Hand me the PR title and body as a draft and stop there. +## Releasing + +1. Write the release notes for users, not reviewers, in a file outside the repo. +2. Run `vp run bump-version --body-file notes.md --release --yes`, where `` is the + release type I give, such as `patch`. It pushes a release branch and opens its PR with the file + as the body. Options other than `--body-file` go to bumpp. +3. If CI reports stale bundle-size claims, run + `vp run replace-bundle-size-claims --write README.md package.json` on that branch, commit, and + push. +4. I merge the PR. The release workflow tags the merge commit, publishes to npm, creates the GitHub + release, and publishes the book. The notes start with the PR body, followed by the PRs merged + since the last tag. + +Steps 2 and 3 push, and step 2 opens a PR. They are the only exception to "Never push, and never +open a PR" above. Run them only on my explicit go-ahead. + ## Writing Style Code and prose go in separate turns. Finish the code, then edit the `.md` in a turn of its own, and diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index 82f235d..9c58a00 100755 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -1,17 +1,39 @@ #!/usr/bin/env sh # Bumps the version on a release branch cut from the latest main, and opens its PR. +# Usage: bump-version [--body-file ] [bumpp options]. The file becomes the PR body. set -eu git diff --quiet HEAD -- || { echo 'tracked files differ from HEAD; commit them first'; exit 1; } +# Takes --body-file out of the arguments, and passes the rest to bumpp. +body_file=/dev/null +n=$# +while [ "$n" -gt 0 ]; do + arg=$1 + shift + n=$((n - 1)) + case $arg in + --body-file) + [ "$n" -gt 0 ] || { echo '--body-file needs a path'; exit 1; } + body_file=$1 + shift + n=$((n - 1)) + ;; + *) set -- "$@" "$arg" ;; + esac +done + +# Read before anything changes, so a missing file stops the release here. +body="$(cat "$body_file")" + git switch main git pull --ff-only # bumpp only picks the version; the branch is named after it, so it is cut afterwards. -bumpp --no-commit --no-tag --no-push +bumpp --no-commit --no-tag --no-push "$@" version="$(node -p "require('./package.json').version")" git switch -c "chore/release-$version" git commit -am "chore: release v$version" git push -u origin HEAD -gh pr create --fill --label skip-changelog +gh pr create --fill --body "$body" --label skip-changelog