From 7dd4877ae2fa2b5ad0ac3d741826ce1898654f87 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 9 May 2021 23:18:58 +0200 Subject: [PATCH] chore: improve generated changelog (#40) --- .chglog/CHANGELOG.tpl.md | 6 +++++- .drone.jsonnet | 11 +++++++++-- .drone.yml | 11 ++++++++--- .prettierignore | 2 ++ 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 .prettierignore diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md index 95a8415..3f7457d 100755 --- a/.chglog/CHANGELOG.tpl.md +++ b/.chglog/CHANGELOG.tpl.md @@ -6,10 +6,14 @@ {{ range .CommitGroups -}} ### {{ .Title }} +{{ $subjects := list }} {{ range .Commits -}} +{{ if not (has .Subject $subjects) -}} - {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ $subjects = append $subjects .Subject -}} {{ end }} -{{ end -}} +{{- end }} +{{- end -}} {{- if .NoteGroups -}} {{ range .NoteGroups -}} diff --git a/.drone.jsonnet b/.drone.jsonnet index e4e9af0..46d78ca 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -142,14 +142,21 @@ local PipelineBuildPackage = { ], }, { - name: 'changelog', + name: 'changelog-generate', 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: 'changelog-format', + image: 'thegeeklab/alpine-tools', + commands: [ + 'prettier CHANGELOG.md', + 'prettier -w CHANGELOG.md', + ], + }, { name: 'publish-github', image: 'plugins/github-release', diff --git a/.drone.yml b/.drone.yml index 171cc60..8339def 100644 --- a/.drone.yml +++ b/.drone.yml @@ -160,13 +160,18 @@ steps: commands: - cd dist/ && sha256sum * > ../sha256sum.txt -- name: changelog +- name: changelog-generate 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: changelog-format + image: thegeeklab/alpine-tools + commands: + - prettier CHANGELOG.md + - prettier -w CHANGELOG.md + - name: publish-github image: plugins/github-release settings: @@ -540,6 +545,6 @@ depends_on: --- kind: signature -hmac: 4f13a27058219c5fe3962fa2d0e77a27f0bc7ebe6b87f76df53f889764e10a66 +hmac: f5b5b01760146e2e2e32771354113cf6cdc894a7143304859f4190a340831abb ... diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..97e0b3e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +.drone.yml +*.tpl.md