From c7a5cbb7006004cc765bc9b6b02a3887f08547ae Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 9 May 2021 23:46:56 +0200 Subject: [PATCH] chore: improve generated changelog (#10) --- .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 829ba51..fd35022 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -128,14 +128,21 @@ local PipelineBuildBinaries = { ], }, { - 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', image: 'plugins/github-release', diff --git a/.drone.yml b/.drone.yml index cd3dd12..5f33d40 100644 --- a/.drone.yml +++ b/.drone.yml @@ -95,13 +95,18 @@ steps: commands: - cd release/ && 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 image: plugins/github-release settings: @@ -170,6 +175,6 @@ depends_on: --- kind: signature -hmac: 1239306894f7ac21f758e71cb72714ae295239b89199a74b4fbf755d9c6c2fea +hmac: ea0f25d6b420728bb13c4500ee174e43f64ce6fcf5f09bd7545142f560ff8b8b ... 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