diff --git a/config/config.go b/config/config.go index 4323aa9a2..7040876af 100644 --- a/config/config.go +++ b/config/config.go @@ -108,7 +108,9 @@ type Project struct { FPM FPM `yaml:",omitempty"` Snapshot Snapshot `yaml:",omitempty"` - // Build Build `yaml:",omitempty"` // deprecated, remove + // this is a hack ¯\_(ツ)_/¯ + SingleBuild Build `yaml:"build,omitempty"` + // test only property indicating the path to the dist folder Dist string `yaml:"-"` } @@ -129,6 +131,6 @@ func LoadReader(fd io.Reader) (config Project, err error) { return config, err } err = yaml.Unmarshal(data, &config) - log.WithField("config", config).Debug("loaded") + log.WithField("config", config).Debug("loaded config file") return } diff --git a/pipeline/defaults/defaults.go b/pipeline/defaults/defaults.go index 1ff64d426..2e45865e5 100644 --- a/pipeline/defaults/defaults.go +++ b/pipeline/defaults/defaults.go @@ -72,7 +72,7 @@ func setBuildDefaults(ctx *context.Context) { } if len(ctx.Config.Builds) == 0 { ctx.Config.Builds = []config.Build{ - buildWithDefaults(ctx, config.Build{}), + buildWithDefaults(ctx, ctx.Config.SingleBuild), } } log.WithField("builds", ctx.Config.Builds).Info("set") diff --git a/pipeline/defaults/defaults_test.go b/pipeline/defaults/defaults_test.go index c40f73c08..b20fb3a12 100644 --- a/pipeline/defaults/defaults_test.go +++ b/pipeline/defaults/defaults_test.go @@ -64,6 +64,21 @@ func TestFillPartial(t *testing.T) { assert.Len(ctx.Config.Archive.Files, 1) } +func TestFillSingleBuild(t *testing.T) { + var assert = assert.New(t) + + var ctx = &context.Context{ + Config: config.Project{ + SingleBuild: config.Build{ + Main: "testreleaser", + }, + }, + } + assert.NoError(Pipe{}.Run(ctx)) + assert.Len(ctx.Config.Builds, 1) + assert.Equal(ctx.Config.Builds[0].Binary, "goreleaser") +} + func TestNotAGitRepo(t *testing.T) { var assert = assert.New(t) folder, err := ioutil.TempDir("", "goreleasertest")