diff --git a/context/context.go b/context/context.go index a78bf4178..b42177211 100644 --- a/context/context.go +++ b/context/context.go @@ -29,8 +29,6 @@ type Context struct { Token string Git GitInfo Artifacts artifact.Artifacts - Checksums []string - Dockers []string ReleaseNotes string Version string Validate bool diff --git a/pipeline/docker/docker.go b/pipeline/docker/docker.go index c628ea614..b1612c401 100644 --- a/pipeline/docker/docker.go +++ b/pipeline/docker/docker.go @@ -9,13 +9,12 @@ import ( "path/filepath" "text/template" - "github.com/goreleaser/goreleaser/internal/artifact" - "github.com/apex/log" "github.com/pkg/errors" "github.com/goreleaser/goreleaser/config" "github.com/goreleaser/goreleaser/context" + "github.com/goreleaser/goreleaser/internal/artifact" "github.com/goreleaser/goreleaser/pipeline" ) diff --git a/pipeline/release/body.go b/pipeline/release/body.go index 25e86325e..0a130d299 100644 --- a/pipeline/release/body.go +++ b/pipeline/release/body.go @@ -6,6 +6,7 @@ import ( "text/template" "github.com/goreleaser/goreleaser/context" + "github.com/goreleaser/goreleaser/internal/artifact" ) const bodyTemplate = `{{ .ReleaseNotes }} @@ -34,13 +35,17 @@ func describeBody(ctx *context.Context) (bytes.Buffer, error) { func describeBodyVersion(ctx *context.Context, version string) (bytes.Buffer, error) { var out bytes.Buffer var template = template.Must(template.New("release").Parse(bodyTemplate)) + var dockers []string + for _, a := range ctx.Artifacts.Filter(artifact.ByType(artifact.DockerImage)).List() { + dockers = append(dockers, a.Name) + } err := template.Execute(&out, struct { ReleaseNotes, GoVersion string DockerImages []string }{ ReleaseNotes: ctx.ReleaseNotes, GoVersion: version, - DockerImages: ctx.Dockers, + DockerImages: dockers, }) return out, err } diff --git a/pipeline/release/body_test.go b/pipeline/release/body_test.go index f0918bb08..053e8f94b 100644 --- a/pipeline/release/body_test.go +++ b/pipeline/release/body_test.go @@ -5,19 +5,26 @@ import ( "os" "testing" + "github.com/goreleaser/goreleaser/internal/artifact" + + "github.com/goreleaser/goreleaser/config" "github.com/goreleaser/goreleaser/context" "github.com/stretchr/testify/assert" ) func TestDescribeBody(t *testing.T) { var changelog = "\nfeature1: description\nfeature2: other description" - var ctx = &context.Context{ - ReleaseNotes: changelog, - Dockers: []string{ - "goreleaser/goreleaser:0.40.0", - "goreleaser/goreleaser:latest", - "goreleaser/godownloader:v0.1.0", - }, + var ctx = context.New(config.Project{}) + ctx.ReleaseNotes = changelog + for _, d := range []string{ + "goreleaser/goreleaser:0.40.0", + "goreleaser/goreleaser:latest", + "goreleaser/godownloader:v0.1.0", + } { + ctx.Artifacts.Add(artifact.Artifact{ + Name: d, + Type: artifact.DockerImage, + }) } out, err := describeBodyVersion(ctx, "go version go1.9 darwin/amd64") assert.NoError(t, err)