diff --git a/AGENTS.md b/AGENTS.md index 09cffc0..1ce799d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -35,23 +35,26 @@ Add it as a Makefile target first, then reference the target from CI. Never let **Do not commit or push to `master` directly.** All changes land on `master` via PR merges. For any code or docs change: 1. Create a feature branch (e.g. `feat/...`, `fix/...`, `docs/...`). -2. Commit there, push the branch, open a PR. +2. Commit there and push the branch. 3. Never run `git commit` while `HEAD` is on `master`, and never run `git push origin master` — even for "small" doc tweaks. Committing to local master (even without pushing) tends to contaminate the merge base of later feature branches. If you notice you're on `master` with uncommitted changes, stash them, switch to a new branch, and pop the stash before committing. -### Version bumps (also via PR) +### Local builds, version bumps, and releases -Remote `master` enforces a **"changes must be made through a pull request"** rule, so there are **no** direct-to-`master` pushes — version bumps included (a `git push origin master` is rejected with `GH013`). Keep the bump as its **own** standalone PR; never let it ride inside a feature/fix PR, so the release history stays readable. +**Local build and install.** Use the version declared by the requested revision. Run `make build-release`, install the binary, and verify it with `termdown --version`. -When the feature/fix PRs that make up a release have all merged into `master`: +**Version bump.** Fetch `origin` and check `Cargo.toml` on `origin/master`. If it declares the requested version, the bump is complete. Otherwise, use a standalone version PR, reusing any open bump PR for the same version. -1. `git checkout master && git pull` to land on the merged tip. -2. Branch off, e.g. `chore/bump-X.Y.Z`. -3. Edit `Cargo.toml` (and `Cargo.lock` — `make build` refreshes it) to the new version. -4. Lock the `CHANGELOG.md` `[Unreleased]` section to `[X.Y.Z] - YYYY-MM-DD`. -5. Commit `chore: bump version to X.Y.Z`, push the branch, open a PR, and squash-merge it once CI is green. -6. `git checkout master && git pull` to land on the squashed bump commit. -7. `git tag -a vX.Y.Z -m "termdown X.Y.Z"` on that commit and `git push origin vX.Y.Z`. +1. Once the changes intended for the version have merged, sync `master` with `git pull --ff-only` and create `chore/bump-X.Y.Z` from it. +2. Set the version in `Cargo.toml`, refresh `Cargo.lock` with `make build`, and rename the `CHANGELOG.md` `[Unreleased]` section to `[X.Y.Z] - YYYY-MM-DD`. +3. Commit `chore: bump version to X.Y.Z`, push the branch, and open the PR. Squash-merge it once CI passes. -Branch protection applies to `refs/heads/master`. Push the version tag from step 7 directly to start the release workflows. `release.yml` publishes the GitHub Release archives, checksums, and installers. `publish-crate.yml` publishes to crates.io independently from the same tag. +**Release.** For a publish request, push an annotated `vX.Y.Z` tag on the commit that merged the version bump into `master`. + +```sh +git tag -a vX.Y.Z -m "termdown X.Y.Z" BUMP_COMMIT_SHA +git push origin vX.Y.Z +``` + +The tag triggers two independent workflows. Verify that `release.yml` creates the GitHub Release with its archives, checksums, and installers, and that `publish-crate.yml` publishes `X.Y.Z` to crates.io.