chore: add changelog generator
This commit is contained in:
parent
bdc2e92454
commit
e048560910
|
@ -0,0 +1,22 @@
|
||||||
|
{{ range .Versions }}<a name="{{ .Tag.Name }}"></a>
|
||||||
|
|
||||||
|
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
|
||||||
|
|
||||||
|
- [Release note](https://libretime.org/docs/releases/{{ .Tag.Name }}/)
|
||||||
|
|
||||||
|
{{ range .CommitGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
|
||||||
|
{{ range reverse .Commits -}}
|
||||||
|
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .RevertCommits -}}
|
||||||
|
### Reverts
|
||||||
|
|
||||||
|
{{ range .RevertCommits -}}
|
||||||
|
- {{ .Revert.Header }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
|
@ -0,0 +1,25 @@
|
||||||
|
style: github
|
||||||
|
template: CHANGELOG.md.tpl
|
||||||
|
info:
|
||||||
|
title: CHANGELOG
|
||||||
|
repository_url: https://github.com/libretime/libretime
|
||||||
|
options:
|
||||||
|
commits:
|
||||||
|
filters:
|
||||||
|
Type: [feat, fix, docs, test, ci]
|
||||||
|
sort_by: Date
|
||||||
|
commit_groups:
|
||||||
|
title_maps:
|
||||||
|
feat: Features
|
||||||
|
fix: Bug Fixes
|
||||||
|
docs: Documentation
|
||||||
|
test: Tests
|
||||||
|
ci: CI
|
||||||
|
sort_by: Custom
|
||||||
|
title_order: [feat, fix, docs, test, ci]
|
||||||
|
header:
|
||||||
|
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
|
||||||
|
pattern_maps:
|
||||||
|
- Type
|
||||||
|
- Scope
|
||||||
|
- Subject
|
3
Makefile
3
Makefile
|
@ -19,6 +19,9 @@ shell-check:
|
||||||
VERSION:
|
VERSION:
|
||||||
tools/version.sh
|
tools/version.sh
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
tools/changelog.sh
|
||||||
|
|
||||||
.PHONY: tarball
|
.PHONY: tarball
|
||||||
tarball: VERSION
|
tarball: VERSION
|
||||||
$(MAKE) -C legacy build
|
$(MAKE) -C legacy build
|
||||||
|
|
|
@ -152,6 +152,15 @@ git show --quiet
|
||||||
git tag -a -m "$VERSION" "$VERSION"
|
git tag -a -m "$VERSION" "$VERSION"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Generate the changelog for the newly tagged version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make changelog
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "chore: generate changelog for $VERSION"
|
||||||
|
```
|
||||||
|
|
||||||
Push the tag upstream to finalize the release process:
|
Push the tag upstream to finalize the release process:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -u
|
||||||
|
|
||||||
|
error() {
|
||||||
|
echo >&2 "error: $*"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
command -v git > /dev/null || error "git command not found!"
|
||||||
|
command -v git-chglog > /dev/null || error "git-chglog command not found!"
|
||||||
|
|
||||||
|
changelog="CHANGELOG.md"
|
||||||
|
tag="${tag:-$(git describe --abbrev=0 --tags || error "could not extract latest tag")}"
|
||||||
|
|
||||||
|
if grep --quiet "<a name=\"$tag\"></a>" "$changelog"; then
|
||||||
|
error "changelog has already been generated for tag $tag!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <(git-chglog "$tag") "$changelog" > "$changelog.tmp"
|
||||||
|
mv "$changelog.tmp" "$changelog"
|
||||||
|
|
||||||
|
if command -v npx > /dev/null; then
|
||||||
|
npx prettier --write "$changelog"
|
||||||
|
fi
|
Loading…
Reference in New Issue