Add the `git-chglog` tool to handle auto-generating the project changelog based on the commit history. Add a custom configuration and file template. Update the Makefile to include a command to generate the changelog.
1.6 KiB
Executable File
CHANGELOG
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
{{ if .Versions -}}
[Unreleased]
{{- if .Unreleased.CommitGroups }} {{ template "commits" .Unreleased.CommitGroups }} {{- end -}}
{{- if .Unreleased.NoteGroups -}} {{ template "notes" .Unreleased.NoteGroups }} {{- end -}} {{- end -}}
{{ range .Versions -}}
{{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ template "commits" .CommitGroups }} {{- if .NoteGroups -}} {{ template "notes" .NoteGroups }} {{- end -}} {{ end }}
This changelog is automatically generated by git-chglog
{{- if .Versions }} [Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...develop {{ range .Versions -}} {{ if .Tag.Previous -}} [{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }} {{ end -}} {{ end -}} {{ end -}}
{{- define "notes" }} {{- range . -}}
{{ .Title }}
{{ range .Notes -}}
- {{ .Body }} {{ end }} {{ end }} {{ end -}}
{{- define "commits" }} {{- range . -}} {{ if or (eq .RawTitle "feat") (eq .RawTitle "fix") }}
{{ .Title }}
{{ range .Commits -}}
- ({{ .Hash.Short }}) {{ if .Scope }}{{ .Scope }}: {{ end }}{{ .Header }} {{ end }} {{ end -}} {{ end -}} {{ end -}}