chore: add automated changelog and release workflow (git-cliff + bump-my-version) - Update changelog#110
chore: add automated changelog and release workflow (git-cliff + bump-my-version) - Update changelog#110marvin8 wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds automated changelog and release tooling: a just release recipe that drives bump-my-version and git-cliff to compute the next semver, generate an unreleased changelog section, pause for manual edit, then commit, tag, and push. Also seeds an empty CHANGELOG.md and codifies commitizen-style commit messages in AGENTS.md. Closes #104.
Changes:
- New
cliff.tomlwith a custom body template and commit parsers groupingfeat/fix/docs/refactor/perf/test/ciand skippingchore. - New
justfilereleaserecipe orchestrating bump → cliff → manual review → commit → bump-tag → push. bump-my-versionconfig added topyproject.toml, tracking the version string inCargo.toml; dev deps gainbump-my-versionandgit-cliff.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Adds bump-my-version/git-cliff dev deps and [tool.bumpversion] config (with a Cargo.toml file entry). |
| cliff.toml | git-cliff template and parser config for changelog generation. |
| justfile | New release recipe driving the end-to-end release flow. |
| CHANGELOG.md | Empty file created as the prepend target for git-cliff. |
| AGENTS.md | Documents the commitizen-style commit message requirement. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| """ | ||
|
|
||
| [git] | ||
| conventional_commits = false |
| search = 'version = "{current_version}"' | ||
| replace = 'version = "{new_version}"' |
| release type: | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| type="{{type}}" | ||
|
|
||
| if [[ "$type" != "patch" && "$type" != "minor" && "$type" != "major" ]]; then | ||
| echo "Error: argument must be patch, minor, or major (got: $type)" | ||
| exit 1 | ||
| fi |
|
|
||
| uv run bump-my-version bump "$type" | ||
|
|
||
| git push |
|
thank you! i am at pycon the next few days - will take a look at this soon |
thejchap
left a comment
There was a problem hiding this comment.
thanks for working on this @marvin8 !
i like the direction this is heading. there are a few changes to the process that i think i'd like to make - i am not deeply familiar with these tools so will defer to you to let me know if it makes sense to continue using them or switch to something different
- commit message format - i don't want to be prescriptive on commit message format, or rely on that to generate changelog sections, at least at this stage in the project. i think this is a bit too structured and introduces a bit more friction to iterating than i would like
- related to the above, is there by any chance a way to instead rely on PR labels to drive changelog categories? for example if i just add 3 simple "Features" "Bug fixes" "Other" labels for now? if not, no problem - can keep it un-sectioned and i will editorialize it manually
- is it possible to have a section to list contributors for each release (like this)?
- can we have GH actions publish a GH Release as well now that we'll have the nice changelog?
| ## style guidelines | ||
|
|
||
| - comments and docs should be capitalized: <https://google.github.io/styleguide/cppguide.html#Punctuation_Spelling_and_Grammar> and <https://peps.python.org/pep-0008/#comments> | ||
| - commit messages must be in commitizen style |
There was a problem hiding this comment.
i would like to avoid this - i am not a huge fan of being too prescriptive on commit message format
| search = 'version = "{current_version}"' | ||
| replace = 'version = "{new_version}"' |
| current_version = "0.0.28" | ||
| commit = true | ||
| tag = true | ||
| tag_name = "{new_version}" |
There was a problem hiding this comment.
does this need to be "v{new_version}"?
|
|
||
| # Release - Usage: just release patch|minor|major | ||
| release type: | ||
| #!/usr/bin/env bash |
There was a problem hiding this comment.
nit: can we move the shell script itself into scripts/release.sh
|
Thanks for the feedback. I am currently busy with something else but should get to addressing your comments later this week. |
|
@marvin8 sounds good! and yes that would be great, those all look legitimate |
- Remove prescriptive commit-message style guideline from AGENTS.md
- Switch changelog categorization from commit prefixes to PR labels via
git-cliff GitHub integration; add contributors section to template
- Add [remote.github] to cliff.toml for PR label and contributor data
- Fix tag_name to use v{new_version} prefix in bump-my-version config
- Anchor Cargo.toml version search to [workspace.package] section with
regex to prevent false matches on pinned dependencies
- Extract inline justfile script to scripts/release.sh; drop justfile
- Rename `type` param to `bump_type` to avoid bash builtin shadowing
- Fix bare `git push` to `git push origin HEAD` for explicit ref
- Add github-release job to release.yml to publish GH Release after
PyPI publish, using git-cliff to generate release notes from PR labels
|
I think I've addressed all review remarks. Fair warning though, I have never used github actions, so I had Claude Code do that part for me. That might be worth having a good look at. Other than that, cliff is supposed to use PR labels now and not commits. I've also removed the commit style requirement in your AGENTS.md file. If I have missed anything, just let me know. |
Summary
git-cliffandbump-my-versionto the dev dependenciescliff.tomlwith commit parsers matching commitizen-style messagesjustfilewith areleaserecipe orchestrating the full release flowbump-my-versionconfig inpyproject.toml(version tracking forCargo.tomlandpyproject.tomlitself)CHANGELOG.mdas the prepend targetAGENTS.mdRelease workflow
bump-my-version show new_versiongit-cliff --unreleased --prependCHANGELOG.mdpyproject.tomlandCargo.tomlFirst-run: manual tag required
git-cliff --unreleasedscopes to commits after the most recent semver tag.The repo has no tags yet, so on first run it would pull the entire commit history
into the changelog.
Before the first
just release, create an annotated tag at the last release commit: