1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/pipeline/release/body.go
Carlos Alexandro Becker 07b2699346 fix: empty line
2018-04-01 15:40:14 -03:00

43 lines
876 B
Go

package release
import (
"bytes"
"text/template"
"github.com/goreleaser/goreleaser/context"
"github.com/goreleaser/goreleaser/internal/artifact"
)
const bodyTemplateText = `{{ .ReleaseNotes }}
{{- with .DockerImages }}
## Docker images
{{ range $element := . }}
- ` + "`docker pull {{ . -}}`" + `
{{- end -}}
{{- end }}
`
var bodyTemplate *template.Template
func init() {
bodyTemplate = template.Must(template.New("release").Parse(bodyTemplateText))
}
func describeBody(ctx *context.Context) (bytes.Buffer, error) {
var out bytes.Buffer
var dockers []string
for _, a := range ctx.Artifacts.Filter(artifact.ByType(artifact.DockerImage)).List() {
dockers = append(dockers, a.Name)
}
err := bodyTemplate.Execute(&out, struct {
ReleaseNotes string
DockerImages []string
}{
ReleaseNotes: ctx.ReleaseNotes,
DockerImages: dockers,
})
return out, err
}