diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100644 index 0000000000000000000000000000000000000000..e0ffe4235e82a87acf75d4151ccf437736e8282f --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,27 @@ +{{ 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 -}} diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..bbab0c90ff5aaa06aedddc2519a6adef7623dd34 --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,58 @@ +style: gitlab +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://gitlab.schukai.com/oss/libraries/go/utilities/data +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 diff --git a/makefiles/changelog.mk b/makefiles/changelog.mk index f1d8fed60aa9de2a659c3466bd346aed4cfed89d..c3ae83114f80b47c10e7d99bb4a8c89eefeaa334 100644 --- a/makefiles/changelog.mk +++ b/makefiles/changelog.mk @@ -17,8 +17,10 @@ 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 @@ -135,4 +137,4 @@ $(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md: ## location of CHANGELOG.md file CHANGELOG_FILE ?= $(PROJECT_ROOT)CHANGELOG.md -EXECUTABLES = $(EXECUTABLES:-) $(GIT_CHGLOG_BIN) \ No newline at end of file +EXECUTABLES = $(EXECUTABLES:-) $(GIT_CHGLOG_BIN) diff --git a/makefiles/go.mk b/makefiles/go.mk index 00ff9478e3e0d69e4370abb88dcaca5f88185437..6cb58e936eb9de9c2d1e3a463c9f2233338c7c5f 100644 --- a/makefiles/go.mk +++ b/makefiles/go.mk @@ -14,3 +14,14 @@ EXECUTABLES = $(EXECUTABLES:-) $(GO); ifeq ($(shell command -v $(GO) 2> /dev/null),) $(error "go is not installed. Please install go <https://go.dev/doc/install>") endif + +GOPATH=$(shell go env GOPATH) + +ifeq ($(GOPATH),) + DIRS := bin pkg src + GOPATH=$(DEPLOYMENT_PATH)/go/ + $(shell mkdir -p $(GOPATH)) + $(shell $(foreach entry,$(DIRS),mkdir -p "$(GOPATH)$(entry)";)) + export PATH=$(PATH):$(GOPATH)/bin +endif + diff --git a/makefiles/target-go-fetch-licenses.mk b/makefiles/target-go-fetch-licenses.mk index 242f3d346950f04bdc2ae8bb3d465b0ba9b7ebda..65fe5cdc864b4fafa6cebf21920dff5f65a55a45 100644 --- a/makefiles/target-go-fetch-licenses.mk +++ b/makefiles/target-go-fetch-licenses.mk @@ -11,16 +11,22 @@ ifeq ($(GO),) endif GO_MOD_FILE := $(SOURCE_PATH)go.mod +GO_LICENSES_BIN := $(shell command -v go-licenses) + + +ifeq ($(GO_LICENSES_BIN),) + $(shell $(GO) install github.com/google/go-licenses@latest) + GO_LICENSES_BIN := $(shell command -v go-licenses 2> /dev/null) + EXECUTABLES = $(EXECUTABLES:-) go-licenses; +endif ifeq ($(shell test -e $(GO_MOD_FILE) && echo -n yes),yes) GO_CURRENT_MODULE := $(shell cat $(GO_MOD_FILE) | head -n1 | cut -d" " -f2) - # go install github.com/google/go-licenses@latest - EXECUTABLES = $(EXECUTABLES:-) go-licenses; endif .PHONY: go-fetch-licenses ## Fetch licenses for all modules -go-fetch-licenses: +go-fetch-licenses: ifeq ($(GO_CURRENT_MODULE),) $(QUIET) $(ECHOERRORMARKER) "no go.mod file found, skipping fetching licenses" else