From 41cccb5b52c8083dfbe04a031fb91d9b19d9a4ca Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 15 Feb 2021 21:18:08 +0100 Subject: [PATCH] ci: auto-generate changelog (#6) --- .chglog/CHANGELOG.tpl.md | 23 +++++++++++++++++++++++ .chglog/config.yml | 25 +++++++++++++++++++++++++ .drone.jsonnet | 9 +++++++++ .drone.yml | 9 ++++++++- .gitignore | 1 + CHANGELOG.md | 13 ------------- 6 files changed, 66 insertions(+), 14 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..884dea8 --- /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/url-parser +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 da417b9..b568b73 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -126,6 +126,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 82933e0..17b98ec 100644 --- a/.drone.yml +++ b/.drone.yml @@ -94,6 +94,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: @@ -162,6 +169,6 @@ depends_on: --- kind: signature -hmac: d4a69a1a967392f8404fb8d708b3a8f8483118d5b7755c88fdb100ce52464680 +hmac: 13e85e1a3c5f6f63c2ccf4c92e916edff86ffa6833baff2d8e4c72824aa2a11a ... diff --git a/.gitignore b/.gitignore index a3f8ac4..53fb4dc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /url-parser* coverage.out +CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 1b13d68..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,13 +0,0 @@ -# Changelog - -## v0.2.1 (2021-01-04) - -### Docs - -- add contributing information - -### Others - -- replace master by main as default branch -- **deps**: update dependencies -- use renovate preset config