From fbca6c51600ed80d99e7f3c95aed781bf3005cbf Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 23 Mar 2021 20:30:40 +0100 Subject: [PATCH] ci: auto-generate changelog --- .chglog/CHANGELOG.tpl.md | 23 +++++++++++++++++++++++ .chglog/config.yml | 25 +++++++++++++++++++++++++ .drone.jsonnet | 9 +++++++++ .drone.yml | 9 ++++++++- 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100755 .chglog/CHANGELOG.tpl.md create mode 100755 .chglog/config.yml diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100755 index 0000000..95a8415 --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,23 @@ +# Changelog + +{{ range .Versions -}} +## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .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 -}} diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100755 index 0000000..8b1b899 --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,25 @@ +style: github +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://github.com/thegeeklab/ansible-later +options: + commit_groups: + title_maps: + feat: Features + fix: Bug Fixes + perf: Performance Improvements + refactor: Code Refactoring + chore: Others + test: Testing + ci: CI Pipeline + docs: Documentation + header: + pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" + pattern_maps: + - Type + - Scope + - Subject + notes: + keywords: + - BREAKING CHANGE diff --git a/.drone.jsonnet b/.drone.jsonnet index 9ee90cf..1fa7f5b 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -158,6 +158,15 @@ local PipelineBuildPackage = { 'cd dist/ && sha256sum * > ../sha256sum.txt', ], }, + { + name: 'changelog', + image: 'thegeeklab/git-chglog', + commands: [ + 'git fetch -tq', + 'git-chglog --no-color --no-emoji ${DRONE_TAG:---next-tag unreleased unreleased}', + 'git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}', + ], + }, { name: 'publish-github', image: 'plugins/github-release', diff --git a/.drone.yml b/.drone.yml index 4c15391..2e1f825 100644 --- a/.drone.yml +++ b/.drone.yml @@ -177,6 +177,13 @@ steps: commands: - cd dist/ && sha256sum * > ../sha256sum.txt +- name: changelog + image: thegeeklab/git-chglog + commands: + - git fetch -tq + - git-chglog --no-color --no-emoji ${DRONE_TAG:---next-tag unreleased unreleased} + - git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased} + - name: publish-github image: plugins/github-release settings: @@ -635,6 +642,6 @@ depends_on: --- kind: signature -hmac: b3355b546c9c55cb7c83d1a6b2ae59ec4177e6495b050bc8ecae62bb7a61eceb +hmac: c4f9763ea636fbabd54c15e260559f1e1948fda7841ef5c2d3d62d860bd863f9 ...