diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100644 index 0000000..05e21ad --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,42 @@ +{{ if .Versions -}} + +## [Unreleased] + +{{ if .Unreleased.CommitGroups -}} +{{ range .Unreleased.CommitGroups -}} +### {{ .Title }} +{{ range .Commits -}} +- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} + +{{ range .Versions }} + +## {{ 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 }} +[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD +{{ 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 0000000..daa7277 --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,33 @@ +style: github +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://forge.cadoles.com/Cadoles/mktools +options: + commits: + filters: + Type: + - feat + - fix + - perf + - refactor + - docs + commit_groups: + title_maps: + feat: Features + fix: Bug Fixes + perf: Performance Improvements + refactor: Code Refactoring + docs: Documentation + header: + pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" + pattern_maps: + - Type + - Scope + - Subject + notes: + keywords: + - BREAKING CHANGE + issues: + prefix: + - '#' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c50f923 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tools/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cc96a7f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ + +## [Unreleased] + +### Bug Fixes +- **changelog:** add missing task dependency + +### Features +- add changelog +- add mkt-changelog task +- **gitea-release:** automatically add tools directory to git ignored files + + + +## 2023.8.23-stable.1207.cd2f1ba - 2023-08-21 +### Features +- initial commit + + +[Unreleased]: https://forge.cadoles.com/Cadoles/mktools/compare/2023.8.23-stable.1207.cd2f1ba...HEAD diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..4c74bd0 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,3 @@ +@Library("cadoles") _ + +standardMakePipeline() \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..871befd --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +.PHONY: all +all: test build + +.PHONY: test +test: tools/checkmake/bin/checkmake + tools/checkmake/bin/checkmake Makefile + +.PHONY: build +build: + +MKT_GITEA_RELEASE_ORG ?= Cadoles +MKT_GITEA_RELEASE_PROJECT ?= mktools + +.PHONY: release +release: + $(MAKE) update-changelog + $(MAKE) \ + MKT_GITEA_RELEASE_ATTACHMENTS="CHANGELOG.md" \ + mkt-gitea-release + + +.PHONY: clean +clean: + rm -rf tools + +.PHONY: update-changelog +update-changelog: + $(MAKE) MKT_GIT_CHGLOG_PROJECT_ORG=Cadoles MKT_GIT_CHGLOG_PROJECT_NAME=mktools mkt-changelog + git add CHANGELOG.md + git commit -m "chore: update changelog" + git push --tags + +include tasks/*.mk \ No newline at end of file diff --git a/tasks/checkmake.mk b/tasks/checkmake.mk new file mode 100644 index 0000000..6652e75 --- /dev/null +++ b/tasks/checkmake.mk @@ -0,0 +1,8 @@ +MKT_CHECKMAKE_VERSION ?= 0.2.2 +MKT_CHECKMAKE_URL ?= https://github.com/mrtazz/checkmake/releases/download/$(MKT_CHECKMAKE_VERSION)/checkmake-$(MKT_CHECKMAKE_VERSION).linux.amd64 + +tools/checkmake/bin/checkmake: + mkdir -p tools/checkmake/bin + grep -qF -- "tools/" ".gitignore" 2>/dev/null || echo "tools/" >> ".gitignore" + curl -sL -o tools/checkmake/bin/checkmake "$(MKT_CHECKMAKE_URL)" + chmod +x tools/checkmake/bin/checkmake \ No newline at end of file diff --git a/tasks/gitea.mk b/tasks/gitea.mk index 77ff1b7..c942e91 100644 --- a/tasks/gitea.mk +++ b/tasks/gitea.mk @@ -1,7 +1,7 @@ MKT_GITEA_RELEASE_PROJECT ?= MKT_GITEA_RELEASE_ORG ?= MKT_GITEA_RELEASE_BASE_URL ?= https://forge.cadoles.com -MKT_GITEA_RELEASE_VERSION ?= +MKT_GITEA_RELEASE_VERSION ?= $(MKT_PROJECT_VERSION) MKT_GITEA_RELEASE_COMMIT_TARGET ?= $(shell git rev-parse HEAD) MKT_GITEA_RELEASE_IS_DRAFT ?= false MKT_GITEA_RELEASE_BODY ?= diff --git a/tasks/version.mk b/tasks/version.mk new file mode 100644 index 0000000..767fbe5 --- /dev/null +++ b/tasks/version.mk @@ -0,0 +1,17 @@ +MKT_PROJECT_VERSION_CHANNEL ?= $(shell git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]' | sed -e 's/[-_ ]//g') + +ifeq ($(MKT_PROJECT_VERSION_CHANNEL),develop) + MKT_PROJECT_SHORT_VERSION_CHANNEL ?= dev +else ifeq ($(MKT_PROJECT_VERSION_CHANNEL),testing) + MKT_PROJECT_SHORT_VERSION_CHANNEL ?= tst +else ifeq ($(MKT_PROJECT_VERSION_CHANNEL),stable) + MKT_PROJECT_SHORT_VERSION_CHANNEL ?= stb +else + MKT_PROJECT_SHORT_VERSION_CHANNEL ?= $(shell echo "$(MKT_PROJECT_VERSION_CHANNEL)" | sed -e 's/[aeiouy]//g' | cut -c1-3) +endif + +MKT_PROJECT_VERSION_DATE ?= $(shell date +%Y.%-m.%-d) +MKT_PROJECT_VERSION_TIMESTAMP ?= $(shell date +%-H%M) + +MKT_PROJECT_VERSION ?= $(MKT_PROJECT_VERSION_DATE)-$(MKT_PROJECT_VERSION_CHANNEL).$(MKT_PROJECT_VERSION_TIMESTAMP).$(shell git rev-parse --short HEAD) +MKT_PROJECT_SHORT_VERSION ?= $(MKT_PROJECT_VERSION_DATE)-$(MKT_PROJECT_SHORT_VERSION_CHANNEL).$(MKT_PROJECT_VERSION_TIMESTAMP)