Skip to content

Commit

Permalink
docs: Tidy up release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Oct 10, 2023
1 parent 82b5fa9 commit 319dd20
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions assets/chezmoi.io/docs/reference/release-history.md.tmpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Release history
{{- range $release := gitHubListReleases "twpayne/chezmoi" }}

{{- $releases := gitHubListReleases "twpayne/chezmoi" }}
{{- $lastReleaseIndex := sub (len $releases) 1 }}
{{- range $index, $release := $releases }}

## [{{ $release.Name | trimPrefix "v" }}]({{ $release.HTMLURL }}) ({{ $release.PublishedAt | gitHubTimestampFormat "2006-01-02" }})

{{ $release.Body
| replaceAllRegex "(?m)^## What's Changed$" ""
| replaceAllRegex "(?m)^## Changelog\\r?$" ""
| replaceAllRegex "(?m)^## (New Contributors)\\r?$" "$1\n"
| replaceAllRegex "\\*\\*(Full Changelog)\\*\\*" "$1"
| replaceAllRegex "(?m)^#+ (Changelog\\r?|What's Changed)$" ""
| replaceAllRegex "(?m)^#+ (.*)\\r?$" "\n\n$1\n"
| replaceAllRegex "\\*\\*(Full Changelog)\\*\\*.*\n" ""
| replaceAllRegex "(https://github\\.com/twpayne/chezmoi/compare/(\\S+))" "[`$2`]($1)"
| replaceAllRegex "@(\\S+)" "[**$0**](https://github.com/$1)"
| replaceAllRegex "pull request #(\\d+)" "pull request https://github.com/twpayne/chezmoi/pull/$1"
Expand All @@ -16,5 +18,14 @@
| replaceAllRegex "(?m)^([0-9a-f]{7,})" "* $1"
| replaceAllRegex "(?m)^\\* ([0-9a-f]{7,})" "* [`$1`](https://github.com/twpayne/chezmoi/commit/$1)"
| replaceAllRegex "\\r\\n" "\\n"
| trim
| default "Internal changes only"
}}

{{- if ne $index $lastReleaseIndex }}
{{- $prevRelease := index $releases (add $index 1) }}

Full changelog: [{{ $prevRelease.Name }}...{{ $release.Name }}](https://github.com/twpayne/chezmoi/compare/{{ $prevRelease.Name }}...{{ $release.Name }})
{{- end }}

{{- end }}

0 comments on commit 319dd20

Please sign in to comment.