Skip to content

Commit d614dd6

Browse files
authored
docs: Update docs for generating a Release Changelog (#189)
1 parent 6705843 commit d614dd6

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ yq e -i '(.blocks.[].run.when) |= (. | sub("main", "release/v1.0.x"))' .semaphor
4141
Use [git-cliff](https://github.com/orhun/git-cliff), using the previous release tag and this one:
4242

4343
```bash
44-
git-cliff <previous-version>..v1.0.0
44+
git-cliff --github-repo "semaphoreio/semaphore" -c cliff.toml <previous-version>..v1.0.0
4545
```
4646

4747
A few notes here:

cliff.toml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# git-cliff with GitHub integration configuration file
2+
3+
[changelog]
4+
# template for the changelog header
5+
header = """
6+
# Changelog\n
7+
All notable changes to this project will be documented in this file.\n
8+
"""
9+
# template for the changelog body
10+
# https://keats.github.io/tera/docs/#introduction
11+
body = """
12+
{% if version %}\
13+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
14+
{% else %}\
15+
## [unreleased]
16+
{% endif %}\
17+
{% for group, commits in commits | group_by(attribute="group") %}
18+
### {{ group | striptags | trim | upper_first }}
19+
{% for commit in commits %}
20+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
21+
{% if commit.breaking %}[**breaking**] {% endif %}\
22+
{{ commit.message | upper_first }} by {% if commit.remote.username %}@{{ commit.remote.username }}{% else %}{{ commit.author.name }}{% endif %}
23+
{% endfor %}
24+
{% endfor %}
25+
26+
"""
27+
# template for the changelog footer
28+
footer = """
29+
<!-- generated by git-cliff -->
30+
"""
31+
# remove the leading and trailing s
32+
trim = true
33+
# postprocessors
34+
postprocessors = [
35+
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
36+
]
37+
# render body even when there are no releases to process
38+
# render_always = true
39+
# output file path
40+
# output = "test.md"
41+
42+
[git]
43+
# parse the commits based on https://www.conventionalcommits.org
44+
conventional_commits = true
45+
# filter out the commits that are not conventional
46+
filter_unconventional = true
47+
# process each line of a commit as an individual commit
48+
split_commits = false
49+
# regex for preprocessing the commit messages
50+
commit_preprocessors = [
51+
# Replace issue numbers
52+
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
53+
# Check spelling of the commit with https://github.com/crate-ci/typos
54+
# If the spelling is incorrect, it will be automatically fixed.
55+
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
56+
]
57+
# regex for parsing and grouping commits
58+
commit_parsers = [
59+
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
60+
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
61+
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
62+
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
63+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
64+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
65+
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
66+
{ message = "^chore\\(release\\): prepare for", skip = true },
67+
{ message = "^chore\\(deps.*\\)", skip = true },
68+
{ message = "^chore\\(pr\\)", skip = true },
69+
{ message = "^chore\\(pull\\)", skip = true },
70+
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
71+
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
72+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
73+
{ message = ".*", group = "<!-- 10 -->💼 Other" },
74+
]
75+
# filter out the commits that are not matched by commit parsers
76+
filter_commits = false
77+
# sort the tags topologically
78+
topo_order = false
79+
# sort the commits inside sections by oldest/newest order
80+
sort_commits = "oldest"

0 commit comments

Comments
 (0)