Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#############################################################################################
#############################################################################################
##
## CHANGELOG
##
#############################################################################################
#############################################################################################
GIT_CHGLOG_BIN := $(shell command -v git-chglog 2> /dev/null)
GIT_CHGLOG_CONFIG_DIR := $(PROJECT_ROOT).chglog
REPOSURL := $(subst .git,,$(subst $(shell git config --get user.name)@,,$(shell git config --get remote.origin.url)))
ifeq ($(GO),)
$(error $(ERRORMARKER) GO is not defined)
endif
ifeq ($(GIT_CHGLOG_BIN),)
$(shell $(GO) install github.com/git-chglog/git-chglog/cmd/git-chglog@latest)
endif
ifneq ($(shell test -d $(GIT_CHGLOG_CONFIG_DIR) && echo -n yes),yes)
$(shell mkdir -p $(GIT_CHGLOG_CONFIG_DIR))
endif
remove-config-files:
$(shell rm -Rf $(GIT_CHGLOG_CONFIG_DIR)/ && mkdir -p $(GIT_CHGLOG_CONFIG_DIR))
.PHONY: update-chglog-files
## update standard git-chglog configuration files
update-chglog-files: remove-config-files $(GIT_CHGLOG_CONFIG_DIR)/config.yml $(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md
$(ECHOMARKER) "update standard git-chglog configuration files"
define GIT_CHGLOG_CONFIG_FILE
style: gitlab
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: $(REPOSURL)
options:
commits:
filters:
Type:
- feat
- fix
- doc
- refactor
- perf
- test
- chore
## deprecated types and typos
- docs
- documentation
- feat
- added
- add
- bugfix
- revert
- update
- updates
- change
- changed
commit_groups:
title_maps:
feat: Add Features
fix: Bug Fixes
doc: Documentation
refactor: Code Refactoring
perf: Performance Improvements
test: Tests
## Chore is used for all other changes that don't fit in the other categories
chore: Changes
## deprecated types and typos
docs: Documentation
documentation: Documentation
added: Add Features
add: Add Features
bugfix: Bug Fixes
revert: Reverts
update: Changes
updates: Changes
change: Changes
changed: Changes
header:
pattern: "^(\\w*)(?:\\(([\\w\\$$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
endef
export GIT_CHGLOG_CONFIG_FILE
$(GIT_CHGLOG_CONFIG_DIR)/config.yml:
$(QUIET) $(ECHO) "$$GIT_CHGLOG_CONFIG_FILE" >> $@
define GIT_CHGLOG_CONFIG_TEMPLATE
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{- if .Versions }}
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $$.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
endef
export GIT_CHGLOG_CONFIG_TEMPLATE
$(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md:
$(QUIET) $(ECHO) "$$GIT_CHGLOG_CONFIG_TEMPLATE" >> $@
## location of CHANGELOG.md file
CHANGELOG_FILE ?= $(PROJECT_ROOT)CHANGELOG.md
EXECUTABLES = $(EXECUTABLES:-) $(GIT_CHGLOG_BIN)