Skip to content

Commit aa1c878

Browse files
committed
ci(release): replace git-chglof with git-cliff
1 parent 547911a commit aa1c878

File tree

10 files changed

+145
-162
lines changed

10 files changed

+145
-162
lines changed

.chglog/.changelogrc.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

.chglog/CHANGELOG.tpl.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

.chglog/config.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
- name: Install dependencies
3838
run: make deps
3939

40+
- name: Set up git-cliff
41+
uses: kenji-miyake/setup-git-cliff@v2
42+
4043
- name: Set up Docker Buildx
4144
uses: docker/setup-buildx-action@v3
4245

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ changelog:
359359
NEXT_TAG=$$(echo $$TAG | sed 's/v//') && \
360360
NEXT_TAG="v$$(echo $$NEXT_TAG | awk -F. '{$$NF = $$NF + 1;} 1' | sed 's/ /./g')" && \
361361
echo "📋 Generating for tag: $$NEXT_TAG" && \
362-
go tool git-chglog --next-tag "$$NEXT_TAG" --output CHANGELOG.md && \
362+
git-cliff --output CHANGELOG.md && \
363363
echo "✅ CHANGELOG.md updated"
364364

365365
.PHONY: changelog-preview
@@ -369,7 +369,7 @@ changelog-preview:
369369
NEXT_TAG=$$(echo $$TAG | sed 's/v//') && \
370370
NEXT_TAG="v$$(echo $$NEXT_TAG | awk -F. '{$$NF = $$NF + 1;} 1' | sed 's/ /./g')" && \
371371
echo "📋 Preview for tag: $$NEXT_TAG" && \
372-
go tool git-chglog --next-tag "$$NEXT_TAG"
372+
git-cliff --unreleased
373373

374374
# Pre-commit hook simulation
375375
.PHONY: pre-commit

cliff.toml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
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+
# [remote.github]
9+
# owner = "damienbutt"
10+
# repo = "emojify-go"
11+
12+
[changelog]
13+
# template for the changelog header
14+
header = """
15+
# Changelog\n
16+
All notable changes to this project will be documented in this file.\n
17+
"""
18+
# template for the changelog body
19+
# https://keats.github.io/tera/docs/#introduction
20+
body = """
21+
{%- macro remote_url() -%}
22+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
23+
{%- endmacro -%}
24+
25+
{%- macro print_commit(commit) -%}
26+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
27+
{% if commit.breaking %}[**breaking**] {% endif %}\
28+
{{ commit.message | upper_first }} - \
29+
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))
30+
{%- endmacro -%}
31+
32+
{%- if version -%}
33+
{%- if previous.version -%}
34+
## [{{ version | trim_start_matches(pat="v") }}]({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
35+
{%- else -%}
36+
## [{{ version | trim_start_matches(pat="v") }}]({{ self::remote_url() }}/tree/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
37+
{%- endif -%}
38+
{%- else -%}
39+
## [unreleased]
40+
{% endif -%}
41+
42+
{%- if previous.version -%}
43+
{%- for group, commits in commits | group_by(attribute="group") %}
44+
### {{ group | striptags | trim | upper_first }}
45+
{%- for commit in commits | filter(attribute="scope") | sort(attribute="scope") %}
46+
{{ self::print_commit(commit=commit) }}
47+
{%- endfor -%}
48+
{%- for commit in commits %}
49+
{%- if not commit.scope -%}
50+
{{ self::print_commit(commit=commit) }}
51+
{%- endif -%}
52+
{%- endfor -%}
53+
{%- endfor -%}
54+
{%- else %}
55+
### 🎉🎉 Initial Release
56+
57+
First official release of emojify-go, a lighting fast Emoji converter for the command line 😱.
58+
{%- endif %}
59+
60+
{%- if github -%}
61+
{%- set excluded_users = ["Norgate-AV", "damienbutt", "actions-user", "github-actions", "github-actions[bot]"] -%}
62+
{%- set first_time_contributors = [] -%}
63+
{%- for contributor in github.contributors -%}
64+
{%- if contributor.is_first_time -%}
65+
{%- if contributor.username not in excluded_users -%}
66+
{%- set first_time_contributors = first_time_contributors | concat(with=[contributor]) -%}
67+
{%- endif -%}
68+
{%- endif -%}
69+
{%- endfor %}
70+
71+
{%- if first_time_contributors | length != 0 %}
72+
## New Contributors ❤️
73+
{%- for contributor in first_time_contributors %}
74+
* @{{ contributor.username }} made their first contribution
75+
{%- if contributor.pr_number %} in [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }})
76+
{%- endif -%}
77+
{%- endfor -%}
78+
{%- endif -%}
79+
{%- endif -%}
80+
"""
81+
# template for the changelog footer
82+
footer = ""
83+
# remove the leading and trailing s
84+
trim = true
85+
# postprocessors
86+
postprocessors = [
87+
{ pattern = '<REPO>', replace = "https://github.com/damienbutt/emojify-go" }, # replace repository URL
88+
]
89+
# render body even when there are no releases to process
90+
# render_always = true
91+
# output file path
92+
# output = "CHANGELOG.md"
93+
94+
[git]
95+
# parse the commits based on https://www.conventionalcommits.org
96+
conventional_commits = true
97+
# filter out the commits that are not conventional
98+
filter_unconventional = true
99+
# process each line of a commit as an individual commit
100+
split_commits = false
101+
# regex for preprocessing the commit messages
102+
commit_preprocessors = [
103+
# Replace issue numbers
104+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))" },
105+
# Check spelling of the commit with https://github.com/crate-ci/typos
106+
# If the spelling is incorrect, it will be automatically fixed.
107+
{ pattern = '.*', replace_command = 'typos --write-changes -' },
108+
]
109+
# regex for parsing and grouping commits
110+
commit_parsers = [
111+
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
112+
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
113+
{ message = "^doc", group = "<!-- 3 -->📚 Documentation", skip = true },
114+
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
115+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor", skip = true },
116+
{ message = "^style", group = "<!-- 5 -->🎨 Styling", skip = true },
117+
{ message = "^test", group = "<!-- 6 -->🧪 Testing", skip = true },
118+
{ message = "^chore\\(release\\): prepare for", skip = true },
119+
{ message = "^chore\\(deps.*\\)", skip = true },
120+
{ message = "^chore\\(pr\\)", skip = true },
121+
{ message = "^chore\\(pull\\)", skip = true },
122+
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks", skip = true },
123+
{ body = ".*security", group = "<!-- 8 -->🛡️ Security", skip = true },
124+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert", skip = true },
125+
{ message = ".*", group = "<!-- 10 -->💼 Other", skip = true },
126+
]
127+
# protect breaking changes from being skipped due to matching a skipping commit_parser
128+
protect_breaking_commits = true
129+
# filter out the commits that are not matched by commit parsers
130+
filter_commits = false
131+
# regex for matching git tags
132+
tag_pattern = "v[0-9].*"
133+
# regex for skipping tags
134+
skip_tags = "beta|alpha"
135+
# sort the tags topologically
136+
topo_order = false
137+
# sort the commits inside sections by oldest/newest order
138+
sort_commits = "newest"

go.mod

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ require (
2727
github.com/42wim/httpsig v1.2.2 // indirect
2828
github.com/4meepo/tagalign v1.4.2 // indirect
2929
github.com/Abirdcfly/dupword v0.1.3 // indirect
30-
github.com/AlecAivazis/survey/v2 v2.3.6 // indirect
3130
github.com/AlekSi/pointer v1.2.0 // indirect
3231
github.com/Antonboom/errname v1.0.0 // indirect
3332
github.com/Antonboom/nilnil v1.0.1 // indirect
@@ -74,7 +73,6 @@ require (
7473
github.com/anchore/go-logger v0.0.0-20241005132348-65b4486fbb28 // indirect
7574
github.com/anchore/go-macholibre v0.0.0-20220308212642-53e6d0aaf6fb // indirect
7675
github.com/anchore/quill v0.5.1 // indirect
77-
github.com/andygrunwald/go-jira v1.16.0 // indirect
7876
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
7977
github.com/ashanbrown/forbidigo v1.6.0 // indirect
8078
github.com/ashanbrown/makezero v1.2.0 // indirect
@@ -150,7 +148,6 @@ require (
150148
github.com/containerd/errdefs v1.0.0 // indirect
151149
github.com/containerd/errdefs/pkg v0.3.0 // indirect
152150
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
153-
github.com/coreos/go-semver v0.3.1 // indirect
154151
github.com/cosiner/argv v0.1.0 // indirect
155152
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
156153
github.com/creack/pty v1.1.24 // indirect
@@ -184,15 +181,13 @@ require (
184181
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
185182
github.com/evilmartians/lefthook v1.12.3 // indirect
186183
github.com/fatih/color v1.18.0 // indirect
187-
github.com/fatih/structs v1.1.0 // indirect
188184
github.com/fatih/structtag v1.2.0 // indirect
189185
github.com/felixge/httpsnoop v1.0.4 // indirect
190186
github.com/firefart/nonamedreturns v1.0.5 // indirect
191187
github.com/fsnotify/fsnotify v1.9.0 // indirect
192188
github.com/fzipp/gocyclo v0.6.0 // indirect
193189
github.com/gabriel-vasile/mimetype v1.4.10-rc1 // indirect
194190
github.com/ghostiam/protogetter v0.3.9 // indirect
195-
github.com/git-chglog/git-chglog v0.15.4 // indirect
196191
github.com/github/smimesign v0.2.0 // indirect
197192
github.com/go-chi/chi v4.1.2+incompatible // indirect
198193
github.com/go-critic/go-critic v0.12.0 // indirect
@@ -282,7 +277,6 @@ require (
282277
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
283278
github.com/hexops/gotextdiff v1.0.3 // indirect
284279
github.com/huandu/xstrings v1.5.0 // indirect
285-
github.com/imdario/mergo v0.3.16 // indirect
286280
github.com/in-toto/attestation v1.1.1 // indirect
287281
github.com/in-toto/in-toto-golang v0.9.0 // indirect
288282
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -311,7 +305,6 @@ require (
311305
github.com/kaptinlin/go-i18n v0.1.4 // indirect
312306
github.com/kaptinlin/jsonschema v0.4.5 // indirect
313307
github.com/karamaru-alpha/copyloopvar v1.2.1 // indirect
314-
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
315308
github.com/kevinburke/ssh_config v1.2.0 // indirect
316309
github.com/kisielk/errcheck v1.9.0 // indirect
317310
github.com/kkHAIKE/contextcheck v1.1.6 // indirect
@@ -327,7 +320,6 @@ require (
327320
github.com/kulti/thelper v0.6.3 // indirect
328321
github.com/kunwardeep/paralleltest v1.0.10 // indirect
329322
github.com/kylelemons/godebug v1.1.0 // indirect
330-
github.com/kyokomi/emoji/v2 v2.2.11 // indirect
331323
github.com/lasiar/canonicalheader v1.1.2 // indirect
332324
github.com/ldez/exptostd v0.4.2 // indirect
333325
github.com/ldez/gomoddirectives v0.6.1 // indirect
@@ -350,7 +342,6 @@ require (
350342
github.com/mattn/go-runewidth v0.0.16 // indirect
351343
github.com/mattn/go-tty v0.0.7 // indirect
352344
github.com/mgechev/revive v1.7.0 // indirect
353-
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
354345
github.com/minio/sha256-simd v1.0.1 // indirect
355346
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
356347
github.com/mitchellh/copystructure v1.2.0 // indirect
@@ -458,12 +449,9 @@ require (
458449
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
459450
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect
460451
github.com/transparency-dev/merkle v0.0.2 // indirect
461-
github.com/trivago/tgo v1.0.7 // indirect
462-
github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect
463452
github.com/ulikunitz/xz v0.5.12 // indirect
464453
github.com/ultraware/funlen v0.2.0 // indirect
465454
github.com/ultraware/whitespace v0.2.0 // indirect
466-
github.com/urfave/cli/v2 v2.25.7 // indirect
467455
github.com/uudashr/gocognit v1.2.0 // indirect
468456
github.com/uudashr/iface v1.3.1 // indirect
469457
github.com/vbatts/tar-split v0.12.1 // indirect
@@ -474,7 +462,6 @@ require (
474462
github.com/xanzy/ssh-agent v0.3.3 // indirect
475463
github.com/xen0n/gosmopolitan v1.2.2 // indirect
476464
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
477-
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
478465
github.com/yagipy/maintidx v1.0.0 // indirect
479466
github.com/yeya24/promlinter v0.3.0 // indirect
480467
github.com/ykadowak/zerologlint v0.1.5 // indirect
@@ -546,7 +533,6 @@ require (
546533

547534
tool (
548535
github.com/evilmartians/lefthook
549-
github.com/git-chglog/git-chglog/cmd/git-chglog
550536
github.com/go-delve/delve/cmd/dlv
551537
github.com/golangci/golangci-lint/cmd/golangci-lint
552538
github.com/google/go-licenses

0 commit comments

Comments
 (0)