1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-10-04 02:39:31 +03:00
git-cliff/website/blog/git-cliff-2.2.0.md
Orhun Parmaksız 1338703a2a
docs(website): add highlights for 2.3.0 (#670)
* docs(website): add highlights for 2.3.0

* docs(website): update other section in highlights

* docs(website): update highlights
2024-06-03 14:12:40 +03:00

6.3 KiB

slug title date authors tags
2.2.0 What's new in 2.2.0? 2024-03-30T00:00:00.000Z orhun
release

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:

  1. Split commits
  2. Process commits

To:

  1. Process commits
  2. 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.

Have a fantastic day! ⛰️