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:
parent
488b6b7750
commit
890832095a
@ -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"`
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user