diff --git a/config/config.go b/config/config.go index 87d6d18a8..ddb730fbf 100644 --- a/config/config.go +++ b/config/config.go @@ -224,6 +224,7 @@ type Project struct { Checksum Checksum `yaml:",omitempty"` Dockers []Docker `yaml:",omitempty"` Changelog Changelog `yaml:",omitempty"` + Dist string `yaml:",omitempty"` // this is a hack ¯\_(ツ)_/¯ SingleBuild Build `yaml:"build,omitempty"` @@ -231,9 +232,6 @@ type Project struct { // should be set if using github enterprise GitHubURLs GitHubURLs `yaml:"github_urls,omitempty"` - // test only property indicating the path to the dist folder - Dist string `yaml:"-"` - // Capture all undefined fields and should be empty after loading XXX map[string]interface{} `yaml:",inline"` } diff --git a/pipeline/defaults/defaults.go b/pipeline/defaults/defaults.go index 29ce9844d..8fd1bf97a 100644 --- a/pipeline/defaults/defaults.go +++ b/pipeline/defaults/defaults.go @@ -33,7 +33,9 @@ func (Pipe) Description() string { // Run the pipe func (Pipe) Run(ctx *context.Context) error { // nolint: gocyclo - ctx.Config.Dist = "dist" + if ctx.Config.Dist == "" { + ctx.Config.Dist = "dist" + } if ctx.Config.Release.NameTemplate == "" { ctx.Config.Release.NameTemplate = ReleaseNameTemplate } diff --git a/pipeline/defaults/defaults_test.go b/pipeline/defaults/defaults_test.go index 5b168ab11..0130a9aab 100644 --- a/pipeline/defaults/defaults_test.go +++ b/pipeline/defaults/defaults_test.go @@ -41,6 +41,7 @@ func TestFillBasicData(t *testing.T) { ctx.Config.Archive.NameTemplate, ctx.Config.Builds[0].Ldflags, ctx.Config.Archive.Files, + ctx.Config.Dist, ) } @@ -52,6 +53,7 @@ func TestFillPartial(t *testing.T) { var ctx = &context.Context{ Config: config.Project{ + Dist: "disttt", Release: config.Release{ GitHub: config.Repo{ Owner: "goreleaser", @@ -86,6 +88,7 @@ func TestFillPartial(t *testing.T) { assert.NotEmpty(t, ctx.Config.Dockers[0].Goarch) assert.NotEmpty(t, ctx.Config.Dockers[0].Dockerfile) assert.Empty(t, ctx.Config.Dockers[0].Goarm) + assert.Equal(t, "disttt", ctx.Config.Dist) } func TestFillSingleBuild(t *testing.T) {