What's new in 2.2.0?
git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history.
It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine.
More information and examples can be found in the GitHub repository.
What's new? β°οΈβ
The full changelog can be found here.
π Configurable Bump Rulesβ
If you are a frequent user of --bump
/--bumped-version
flags then this new feature is for you!
git-cliff
now supports customizing the behavior of version bumps.
Add the following section to your cliff.toml
for configuration:
[bump]
# Configures automatic minor version increments for feature changes.
#
# When true, a feature will always trigger a minor version update.
#
# When false, a feature will trigger:
# - a patch version update if the major version is 0.
# - a minor version update otherwise.
features_always_bump_minor = true
# Configures 0 -> 1 major version increments for breaking changes.
#
# When true, a breaking change commit will always trigger a major version update
# (including the transition from version 0 to 1)
#
# When false, a breaking change commit will trigger:
# - a minor version update if the major version is 0.
# - a major version update otherwise.
breaking_always_bump_major = true
π οΈ Better Template Errorsβ
Template rendering errors are now more verbose!
For example, let's throw an error in the template with using throw function:
[changelog]
body = """
{{ throw(message="something happened!") }}
"""
When you run git-cliff
:
ERROR git_cliff > Template render error:
Function call 'throw' failed
something happened!
π€ Auto Detecting Configβ
If you configured git-cliff
from Cargo.toml
via metadata table ([workspace.metadata.git-cliff.changelog]
), running git cliff
is now simply enough!
$ git cliff
# is same as
$ git cliff --config Cargo.toml
We also updated the config detection mechanism to support the following cases:
cliff.toml | project manifest (e.g. Cargo.toml ) | use config from: |
---|---|---|
β | β | cliff.toml |
β | β | cliff.toml |
β | β | Cargo.toml |
β | β | builtin |
See Rust & Python integration for more information.
π¦ Commit Processing Orderβ
The order of commit processing is changed from:
- Split commits
- Process commits
To:
- Process commits
- Split commits (and process the split commits)
This makes it possible to e.g. preprocess commits, split them by newline and then process each line as conventional commit.
See #555 for an example.
βοΈ Trim Textβ
We changed the commit parser behavior to always trim the text (commit message, body, etc.) before matching it with a regex.
This means that you will be able to use $
in the regex for matching until the end.
For example:
[git]
commit_parsers = [
{ message = '^(fix|feat|setup|doc|refactor|test|optimization)\([A-Za-z0-9_-]+?\))+(:\ .*)$', group = "test"},
]
π Quick Installation in CIβ
You can now install git-cliff
in your GitHub Actions CI easily with taiki-e/install-action
!
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install git-cliff
uses: taiki-e/install-action@git-cliff
- name: Generate changelog
run: git-cliff
π§° Otherβ
- (changelog) Return the last version if there is nothing to bump - (45c87f2)
- (command) Add missing environment variables for Windows (#532) - (9722784)
- (npm) Publish rc version for prereleases (#528) - (16bea51)
- (pypi) Update maturin version (#539) - (10b7ab8)
Contributions π₯β
Any contribution is highly appreciated! See the contribution guidelines for getting started.
Feel free to submit issues and join our Discord / Matrix for discussion!
Follow git-cliff
on Twitter & Mastodon to not miss any news!
Support πβ
If you liked git-cliff
and/or my other projects on GitHub, consider donating to support my open source endeavors.
- π GitHub Sponsors: @orhun
- β Buy Me A Coffee: https://www.buymeacoffee.com/orhun
Have a fantastic day! β°οΈ