1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/internal/pipe/release/body.go
Carlos Alexandro Becker 30ff48a5a6
feat: remove docker images from changelog (#2708)
refs #2707

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2021-11-30 21:13:35 -03:00

41 lines
879 B
Go

package release
import (
"bytes"
"text/template"
"github.com/goreleaser/goreleaser/internal/tmpl"
"github.com/goreleaser/goreleaser/pkg/context"
)
const bodyTemplateText = `{{ with .Header }}{{ . }}{{ "\n" }}{{ end }}
{{- .ReleaseNotes }}
{{- with .Footer }}{{ "\n" }}{{ . }}{{ end }}
`
func describeBody(ctx *context.Context) (bytes.Buffer, error) {
var out bytes.Buffer
t := tmpl.New(ctx)
header, err := t.Apply(ctx.Config.Release.Header)
if err != nil {
return out, err
}
footer, err := t.Apply(ctx.Config.Release.Footer)
if err != nil {
return out, err
}
bodyTemplate := template.Must(template.New("release").Parse(bodyTemplateText))
err = bodyTemplate.Execute(&out, struct {
Header string
Footer string
ReleaseNotes string
}{
Header: header,
Footer: footer,
ReleaseNotes: ctx.ReleaseNotes,
})
return out, err
}