Skip to content

Commit a5694aa

Browse files
committed
build(changelog): same formats for CHANGELOG.md and GitHub release
1 parent 5166941 commit a5694aa

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

.goreleaser.yaml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,39 @@ snapshot:
106106
version_template: "{{ .Tag }}"
107107

108108
changelog:
109+
use: github
109110
sort: asc
111+
abbrev: 7
112+
format: '- {{ .Message }} by @{{ .AuthorUsername }} ({{ .AbbrevSHA }})'
110113
filters:
111114
exclude:
112-
- "^docs:"
113-
- "^test:"
115+
- '^chore\(release\):'
116+
groups:
117+
- title: ':rocket: New features'
118+
regexp: '^feat.*'
119+
order: 0
120+
- title: ':bug: Bug fixes'
121+
regexp: '^fix.*'
122+
order: 1
123+
- title: ':screwdriver:chore'
124+
regexp: '^chore.*'
125+
order: 2
126+
- title: ':zap: Performance'
127+
regexp: '^perf.*'
128+
order: 3
129+
- title: ':pencil: Refactor'
130+
regexp: '^refactor.*'
131+
order: 4
132+
- title: ':books: Documentation'
133+
regexp: '^docs.*'
134+
order: 5
135+
- title: ':test_tube: Tests'
136+
regexp: '^test.*'
137+
order: 6
138+
- title: ':building_construction: ci'
139+
regexp: '^(ci|build).*'
140+
order: 7
114141

115142
release:
116143
prerelease: auto
117144
make_latest: true
118-
header: |
119-
## Commitizen ({{ .Date }})
120-
121-
New release of Commitizen Go CLI

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ $(GOLANGCI_LINT_BIN):
3434

3535
.ONESHELL:
3636
version:
37+
@if [ "$$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then \
38+
echo "Release can only be created from the main branch"; \
39+
exit 1; \
40+
fi
3741
@if ! command -v git-cliff &> /dev/null; then \
3842
echo "git-cliff is not installed. Please install it from https://git-cliff.org/docs/installation/"; \
3943
exit 1; \
@@ -47,4 +51,5 @@ version:
4751
git add internal/version/version.go README.md CHANGELOG.md; \
4852
git commit -m "chore(release): $$version"; \
4953
git tag "$$version"; \
54+
git push origin main;
5055
git push origin $$version;

cliff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ body = """
1111
{% for group, commits in commits | group_by(attribute="group") %}
1212
### {{ group }}
1313
{% for commit in commits %}\
14-
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }} by {% if commit.remote.username %}[@{{commit.remote.username}}](https://github.com/{{commit.remote.username}}) {% else %}{{ commit.author.name }}{% endif %}
14+
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }} by {% if commit.remote.username %}[@{{commit.remote.username}}](https://github.com/{{commit.remote.username}}) {% else %}{{ commit.author.name }}{% endif %} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/isokolovskii/commitizen/commit/{{ commit.id }}))
1515
{% endfor %}\n
1616
{% endfor %}\n
1717
"""

0 commit comments

Comments
 (0)