############################################################################################# ############################################################################################# ## ## 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) GIT_CHGLOG_BIN := $(shell command -v git-chglog 2> /dev/null) 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)