1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00

feat: allow to skip the release pipe entirely

This commit is contained in:
Carlos Alexandro Becker 2018-04-24 20:36:05 -07:00 committed by Carlos Alexandro Becker
parent 488b6b7750
commit 890832095a
3 changed files with 19 additions and 0 deletions

View File

@ -118,6 +118,7 @@ type Release struct {
GitHub Repo `yaml:",omitempty"`
Draft bool `yaml:",omitempty"`
Prerelease bool `yaml:",omitempty"`
Disable bool `yaml:",omitempty"`
NameTemplate string `yaml:"name_template,omitempty"`
}

View File

@ -21,6 +21,9 @@ func (Pipe) String() string {
// Default sets the pipe defaults
func (Pipe) Default(ctx *context.Context) error {
if ctx.Config.Release.Disable {
return nil
}
if ctx.Config.Release.NameTemplate == "" {
ctx.Config.Release.NameTemplate = "{{.Tag}}"
}
@ -45,6 +48,9 @@ func (Pipe) Run(ctx *context.Context) error {
}
func doRun(ctx *context.Context, c client.Client) error {
if ctx.Config.Release.Disable {
return pipeline.Skip("release pipe is disabled")
}
if ctx.SkipPublish {
return pipeline.ErrSkipPublishEnabled
}

View File

@ -136,6 +136,18 @@ func TestSnapshot(t *testing.T) {
assert.False(t, client.UploadedFile)
}
func TestPipeDisabled(t *testing.T) {
var ctx = context.New(config.Project{
Release: config.Release{
Disable: true,
},
})
client := &DummyClient{}
testlib.AssertSkipped(t, doRun(ctx, client))
assert.False(t, client.CreatedRelease)
assert.False(t, client.UploadedFile)
}
func TestDefault(t *testing.T) {
_, back := testlib.Mktmp(t)
defer back()