Skip to content

Commit 185e98e

Browse files
committed
chore: add git cliff for changelog
1 parent 5ae044b commit 185e98e

File tree

4 files changed

+201
-0
lines changed

4 files changed

+201
-0
lines changed

cliff.toml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# A Tera template to be rendered for each release in the changelog.
6+
# See https://keats.github.io/tera/docs/#introduction
7+
body = """
8+
{% if version %}\
9+
## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}\
10+
{% else %}\
11+
## Unreleased
12+
{% endif %}\
13+
{% for group, commits in commits | group_by(attribute="group") %}
14+
### {{ group | upper_first }}
15+
{% for commit in commits %}\
16+
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
17+
{% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif %}\
18+
{% if commit.remote.pr_number %} in #{{ commit.remote.pr_number }}\
19+
{% else %} in ([{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }}))\
20+
{%- endif %}
21+
{% endfor %}\
22+
{% endfor %}\
23+
{% raw %}\n{% endraw %}
24+
"""
25+
26+
[git]
27+
conventional_commits = true
28+
filter_commits = true
29+
commit_parsers = [
30+
{ message = "^feat", group = "Features" },
31+
{ message = "^fix", group = "Bug Fixes" },
32+
{ message = "^doc", group = "Documentation" },
33+
{ message = "^perf", group = "Performance" },
34+
{ message = "^refactor", group = "Refactor" },
35+
{ message = "^style", group = "Styling" },
36+
{ message = "^test", group = "Testing" },
37+
{ message = "^chore\\(release\\):", skip = true },
38+
{ message = "^chore|^ci", group = "Miscellaneous Tasks" },
39+
]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"@typescript-eslint/rule-tester": "^8.44.0",
4141
"eslint": "^9.35.0",
4242
"eslint-doc-generator": "^2.2.2",
43+
"git-cliff": "^2.10.0",
4344
"prettier": "^3.6.2",
4445
"tsdown": "^0.15.2",
4546
"tsx": "^4.20.5",

pnpm-lock.yaml

Lines changed: 146 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/bump.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
version=$(pnpm git-cliff --bumped-version)
4+
5+
if [[ $version == v* ]]; then
6+
version=${version:1}
7+
fi
8+
9+
pnpm git-cliff --tag "${version}" --output CHANGELOG.md
10+
pnpm version "${version}" --no-git-tag-version
11+
12+
git add CHANGELOG.md package.json
13+
14+
git commit -m "chore(release): v${version}"
15+
git tag -a -m "${version}" v"${version}"

0 commit comments

Comments
 (0)