Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <type> --yes`, where `<type>` 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
Expand Down
26 changes: 24 additions & 2 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
@@ -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 <path>] [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
Loading