Skip to content

Commit 87851ce

Browse files
sthulbphipag
andauthored
chore(ci): fix changelog generation (#2207)
* chore(ci): fix changelog generation * update change log on release * update to use sha256 --------- Co-authored-by: Philipp Page <github@philipp.page>
1 parent dd7a49c commit 87851ce

File tree

4 files changed

+1121
-279
lines changed

4 files changed

+1121
-279
lines changed

.chglog/CHANGELOG.tpl.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<!-- changelog is partially generated, so it doesn't follow headings and required structure, so we disable it. -->
2+
<!-- markdownlint-disable -->
3+
4+
{{ if .Versions -}}
5+
<a name="unreleased"></a>
6+
# Unreleased
7+
8+
{{ if .Unreleased.CommitGroups -}}
9+
{{ range .Unreleased.CommitGroups -}}
10+
## {{ .Title }}
11+
12+
{{ range .Commits -}}
13+
{{ if and (not (hasPrefix .Subject "changelog rebuild")) (not (hasPrefix .Subject "layer docs update")) (not (hasPrefix .Subject "bump version to")) -}}
14+
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
15+
{{ end -}}
16+
{{ end }}
17+
{{ end -}}
18+
{{ end -}}
19+
{{ end -}}
20+
21+
{{ range .Versions }}
22+
<a name="{{ .Tag.Name }}"></a>
23+
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
24+
{{ range .CommitGroups -}}
25+
26+
## {{ .Title }}
27+
28+
{{ range .Commits -}}
29+
{{ if and (not (hasPrefix .Subject "changelog rebuild")) (not (hasPrefix .Subject "layer docs update")) (not (hasPrefix .Subject "bump version to")) -}}
30+
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
31+
{{ end -}}
32+
{{ end }}
33+
{{ end -}}
34+
35+
{{- if .RevertCommits -}}
36+
## Reverts
37+
{{ range .RevertCommits -}}
38+
* {{ .Revert.Header }}
39+
{{ end }}
40+
{{ end -}}
41+
42+
{{- if .MergeCommits -}}
43+
## Pull Requests
44+
45+
{{ range .MergeCommits -}}
46+
* {{ .Header }}
47+
{{ end }}
48+
{{ end -}}
49+
50+
{{- if .NoteGroups -}}
51+
{{ range .NoteGroups -}}
52+
## {{ .Title }}
53+
{{ range .Notes }}
54+
{{ .Body }}
55+
{{ end }}
56+
{{ end -}}
57+
{{ end -}}
58+
{{ end -}}
59+
60+
{{- if .Versions }}
61+
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
62+
{{ range .Versions -}}
63+
{{ if .Tag.Previous -}}
64+
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
65+
{{ end -}}
66+
{{ end -}}
67+
{{ end -}}

.chglog/config.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
style: github
2+
template: CHANGELOG.tpl.md
3+
info:
4+
title: CHANGELOG
5+
repository_url: https://github.com/aws-powertools/powertools-lambda-java
6+
options:
7+
commits:
8+
filters:
9+
Type:
10+
- feat
11+
- fix
12+
- perf
13+
- refactor
14+
- docs
15+
- chore
16+
- revert
17+
commit_groups:
18+
title_maps:
19+
feat: Features
20+
fix: Bug Fixes
21+
perf: Performance Improvements
22+
refactor: Code Refactoring
23+
docs: Documentation
24+
chore: Maintenance
25+
revert: Regression
26+
header:
27+
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
28+
pattern_maps:
29+
- Type
30+
- Scope
31+
- Subject
32+
notes:
33+
keywords:
34+
- BREAKING CHANGE
35+
# issues:
36+
# prefix:
37+
# - #

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,10 @@ jobs:
240240
git config pull.rebase true
241241
git config remote.origin.url >&-
242242
- id: branch
243-
name: Create branch
243+
name: Create branch and update change log
244244
run: |
245245
git checkout -b ci-${{ github.run_id }}
246+
docker run -v "${PWD}":/workdir quay.io/git-chglog/git-chglog:sha256:c791b1e8264387690cce4ce32e18b4f59ca3ffd8d55cb4093dc6de74529493f4 > CHANGELOG.md
246247
git commit -am "chore(ci): bump version to ${{ inputs.version }}"
247248
git push origin ci-${{ github.run_id }}
248249
- id: create_pr

0 commit comments

Comments
 (0)