1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fix: don't append empty header/footer to changelog (#1918)

This commit is contained in:
Christian Muehlhaeuser 2020-11-25 01:09:34 +01:00 committed by GitHub
parent a6c4b7e862
commit 56f34935d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,15 +94,17 @@ func (Pipe) Run(ctx *context.Context) error {
changelogStringJoiner = " \n"
}
ctx.ReleaseNotes = strings.Join(
[]string{
ctx.ReleaseHeader,
"## Changelog",
strings.Join(entries, changelogStringJoiner),
ctx.ReleaseFooter,
},
"\n\n",
)
changelogElements := []string{
"## Changelog",
strings.Join(entries, changelogStringJoiner),
}
if len(ctx.ReleaseHeader) > 0 {
changelogElements = append([]string{ctx.ReleaseHeader}, changelogElements...)
}
if len(ctx.ReleaseFooter) > 0 {
changelogElements = append(changelogElements, ctx.ReleaseFooter)
}
ctx.ReleaseNotes = strings.Join(changelogElements, "\n\n")
var path = filepath.Join(ctx.Config.Dist, "CHANGELOG.md")
log.WithField("changelog", path).Info("writing")