1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00

feat: allow override dist folder

Allow configuring the dist folder via
config file.

Closes #421
This commit is contained in:
Carlos Alexandro Becker 2017-11-26 21:25:51 -02:00 committed by Carlos Alexandro Becker
parent 2cc10c3cc8
commit 8e6133c70c
3 changed files with 7 additions and 4 deletions

View File

@ -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"`
}

View File

@ -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
}

View File

@ -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) {