Skip to content

Commit

Permalink
maint/build ~ add CHANGELOG (using git-chglog) configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Oct 4, 2019
1 parent a73208e commit f4b46e1
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- /* <!-- markdownlint-disable --><!-- spellchecker:ignore markdownlint --> */ -}}

{{- define "format-commit" -}}
* {{ if .Scope }}{{ .Type }}/**{{ .Scope }}**: {{ .Subject }}{{ else }}{{ .Header }}{{ end }} &ac; [`{{ .Hash.Short }}`]({{ commitURL .Hash.Long }})
{{ end -}}

{{- define "format-commit-group" }}
#### {{ .Title }}

{{ range .Commits }}{{ template "format-commit" . -}}{{ end -}}
{{ end -}}

# CHANGELOG <br/> [{{ $.Info.Title }}]({{ $.Info.RepositoryURL }})
{{ if .Unreleased.CommitGroups }}{{/* <a name="unreleased"></a> */}}
## [Unreleased]
{{ range .Unreleased.CommitGroups }}{{ template "format-commit-group" . }}{{ end -}}
{{ end -}}

{{ range .Versions }}
---
{{ $output := false -}}
{{/* <a name="{{ .Tag.Name }}"></a> */}}
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} <small>({{ datetime "2006-01-02" .Tag.Date }})</small>
{{ if .CommitGroups -}}
{{ range .CommitGroups }}{{ if eq .Title "Features" }}{{ $output = true }}{{ template "format-commit-group" . }}{{- end -}}{{- end -}}
{{ range .CommitGroups }}{{ if eq .Title "Enhancements" }}{{ $output = true }}{{ template "format-commit-group" . }}{{- end -}}{{- end -}}
{{ range .CommitGroups }}{{ if eq .Title "Changes" }}{{ $output = true }}{{ template "format-commit-group" . }}{{- end -}}{{- end -}}
{{ range .CommitGroups }}{{ if eq .Title "Fixes" }}{{ $output = true }}{{ template "format-commit-group" . }}{{- end -}}{{- end -}}
{{ range .CommitGroups }}{{ if not (eq .Title "Features" "Enhancements" "Changes" "Fixes") }}{{ $output = true }}{{ template "format-commit-group" . }}{{- end -}}{{- end -}}
{{- end -}}

{{ if .RevertCommits }}{{ $output = true }}
#### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end -}}
{{ end -}}

{{ if .MergeCommits }}{{ $output = true }}
#### Pull Requests

{{ range .MergeCommits -}}
* {{ .Header }}
{{ end -}}
{{ end -}}

{{ if .NoteGroups -}}{{ $output = true }}
{{ range .NoteGroups -}}
#### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if not $output }}
*No changelog for this release.*
{{ end -}}
{{- end -}}
76 changes: 76 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# spell-checker:ignore bugfix maint
# spell-checker:ignore chglog
info:
title: xdg-portable
repository_url: https://github.com/rivy/js.xdg-portable
style: github
template: CHANGELOG.tpl.md
options:
commits:
filters:
Type:
- change
- docs
- feat
- fix
- maint
- perf
- refactor
# - style
- test
- update
# - version
type_maps:
# basic types (enables type match case-insensitivity)
change: change
docs: docs
feat: feat
fix: fix
maint: maint
perf: perf
refactor: refactor
test: test
# style: style
update: update
# version: version
# aggregating types
add: change
added: change
bugfix: fix
build: maint
changed: change
chore: maint
fixed: fix
fixes: fix
updated: update
upkeep: maint
commit_groups:
group_by: Type
sort_by: Title
title_maps:
change: Changes
docs: Documentation
feat: Features
fix: Fixes
maint: Maintenance
perf: Enhancements
refactor: Refactoring
# style: Style Improvements
test: Test Improvements
update: Dependency Updates
# version: Version Changes
header:
pattern: "^(\\w+)(?:\\s*\\/(\\S+))\\s*[~:]?\\s(.*)$|^(\\w+)(?:\\s*\\(([^)]+)\\))?\\s*[~:]?\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
- Type
- Scope
- Subject
tag:
# pattern: "^([RrVv](-[Vv]?)?)?\\d.*$"
pattern: "^(?i)([v])?\\d.*$"
notes:
keywords:
- BREAKING CHANGE

0 comments on commit f4b46e1

Please sign in to comment.