From d32a1ee2d0b6e187c027ac1911ebb26ba1c5a404 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 15 Feb 2021 10:46:58 +0100 Subject: [PATCH] ci: auto-generate changelog (#10) --- .chglog/CHANGELOG.tpl.md | 23 +++++++++++++++++++++++ .chglog/config.yml | 25 +++++++++++++++++++++++++ .drone.jsonnet | 9 +++++++++ .drone.yml | 9 ++++++++- .gitignore | 1 + CHANGELOG.md | 11 ----------- 6 files changed, 66 insertions(+), 12 deletions(-) create mode 100755 .chglog/CHANGELOG.tpl.md create mode 100755 .chglog/config.yml delete mode 100644 CHANGELOG.md 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..8548d73 --- /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/drone-docker-buildx +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 03f9d2b..3292808 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -114,6 +114,15 @@ local PipelineBuildBinaries = { 'cd release/ && 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', image: 'plugins/github-release', diff --git a/.drone.yml b/.drone.yml index 46b65fd..ff03835 100644 --- a/.drone.yml +++ b/.drone.yml @@ -86,6 +86,13 @@ steps: commands: - cd release/ && 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 image: plugins/github-release settings: @@ -381,6 +388,6 @@ depends_on: --- kind: signature -hmac: f3927845c8739c33bd85d97dc6a81e73b88de2bfb4e592b6943db9e890bb4d47 +hmac: 569c62e3b5bb765f163cddd2755319d8b1d3d10481ce5955ff8f4e7d54ce6ac4 ... diff --git a/.gitignore b/.gitignore index 3479735..b6cec9b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /drone-docker-buildx* coverage.out +CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 47bc747..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,11 +0,0 @@ -# Changelog - -## v20.10.2 (2021-01-22) - -### New Features - -- set DOCKER_IMAGE_CREATED as build-arg - -### Others - -- **deps**: update dependencies