Skip to content

Commit ff53fb9

Browse files
authored
Merge pull request #10 from ZeroKnowledgeNetwork/9-ci-init-changelog
ci: generate changelog from git commits for release notes
2 parents a70bc23 + 8f0b486 commit ff53fb9

File tree

2 files changed

+99
-1
lines changed

2 files changed

+99
-1
lines changed

β€Ž.github/workflows/publish-to-auto-release.ymlβ€Ž

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
runs-on: ${{ matrix.platform }}
3030
steps:
3131
- uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
fetch-tags: true
3235

3336
- name: setup node
3437
uses: actions/setup-node@v4
@@ -61,13 +64,23 @@ jobs:
6164
run: |
6265
perl -pi -e 's/^version = ".*"/version = "${{ env.VERSION }}"/' src-tauri/Cargo.toml
6366
67+
- name: install git-cliff
68+
run: cargo install git-cliff || true
69+
70+
- name: generate changelog
71+
id: changelog
72+
run: |
73+
echo 'changelog<<EOF' >> $GITHUB_OUTPUT
74+
git-cliff --latest --strip all --use-branch-tags >> $GITHUB_OUTPUT
75+
echo 'EOF' >> $GITHUB_OUTPUT
76+
6477
- uses: tauri-apps/tauri-action@v0
6578
env:
6679
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6780
with:
6881
tagName: v${{ env.VERSION }}
6982
releaseName: v${{ env.VERSION }}
70-
releaseBody: "See the assets to download this version and install."
83+
releaseBody: "${{ steps.changelog.outputs.changelog }}"
7184
releaseDraft: true
7285
prerelease: true
7386
args: ${{ matrix.args }}

β€Žcliff.tomlβ€Ž

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

0 commit comments

Comments
Β (0)