diff --git a/internal/pipe/brew/brew.go b/internal/pipe/brew/brew.go index 01b808c4b..04fe64ba9 100644 --- a/internal/pipe/brew/brew.go +++ b/internal/pipe/brew/brew.go @@ -119,11 +119,6 @@ func doRun(ctx *context.Context, brew config.Homebrew, client client.Client) err return pipe.Skip("brew section is not configured") } - // TODO mavogel: in another PR - // check if release pipe is not configured! - // if ctx.Config.Release.Disable { - // } - var filters = []artifact.Filter{ artifact.Or( artifact.ByGoos("darwin"), @@ -163,6 +158,9 @@ func doRun(ctx *context.Context, brew config.Homebrew, client client.Client) err if ctx.Config.Release.Draft { return pipe.Skip("release is marked as draft") } + if ctx.Config.Release.Disable { + return pipe.Skip("release is disabled") + } if strings.TrimSpace(brew.SkipUpload) == "auto" && ctx.Semver.Prerelease != "" { return pipe.Skip("prerelease detected with 'auto' upload, skipping homebrew publish") } diff --git a/internal/pipe/brew/brew_test.go b/internal/pipe/brew/brew_test.go index 8bbb12d52..992931e15 100644 --- a/internal/pipe/brew/brew_test.go +++ b/internal/pipe/brew/brew_test.go @@ -434,6 +434,12 @@ func TestRunPipeNoUpload(t *testing.T) { ctx.SkipPublish = false assertNoPublish(tt) }) + t.Run("release disabled", func(tt *testing.T) { + ctx.Config.Release.Disable = true + ctx.Config.Brews[0].SkipUpload = "false" + ctx.SkipPublish = false + assertNoPublish(tt) + }) t.Run("skip prerelease publish", func(tt *testing.T) { ctx.Config.Release.Draft = false ctx.Config.Brews[0].SkipUpload = "auto" diff --git a/internal/pipe/scoop/scoop.go b/internal/pipe/scoop/scoop.go index ddd32f656..494b15e0f 100644 --- a/internal/pipe/scoop/scoop.go +++ b/internal/pipe/scoop/scoop.go @@ -88,6 +88,9 @@ func doRun(ctx *context.Context, client client.Client) error { if ctx.Config.Release.Draft { return pipe.Skip("release is marked as draft") } + if ctx.Config.Release.Disable { + return pipe.Skip("release is disabled") + } return client.CreateFile( ctx, ctx.Config.Scoop.CommitAuthor, diff --git a/internal/pipe/scoop/scoop_test.go b/internal/pipe/scoop/scoop_test.go index e745d7080..ecba4d049 100644 --- a/internal/pipe/scoop/scoop_test.go +++ b/internal/pipe/scoop/scoop_test.go @@ -495,6 +495,46 @@ func Test_doRun(t *testing.T) { }, shouldErr("release is marked as draft"), }, + { + "release is disabled", + args{ + &context.Context{ + TokenType: context.TokenTypeGitHub, + Git: context.GitInfo{ + CurrentTag: "v1.0.1", + }, + Version: "1.0.1", + Artifacts: artifact.New(), + Config: config.Project{ + Builds: []config.Build{ + {Binary: "test", Goarch: []string{"amd64"}, Goos: []string{"windows"}}, + }, + Dist: ".", + ProjectName: "run-pipe", + Archive: config.Archive{ + Format: "tar.gz", + }, + Release: config.Release{ + Disable: true, + }, + Scoop: config.Scoop{ + Bucket: config.Repo{ + Owner: "test", + Name: "test", + }, + Description: "A run pipe test formula", + Homepage: "https://github.com/goreleaser", + }, + }, + }, + &DummyClient{}, + }, + []*artifact.Artifact{ + {Name: "foo_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Path: file}, + {Name: "foo_1.0.1_windows_386.tar.gz", Goos: "windows", Goarch: "386", Path: file}, + }, + shouldErr("release is disabled"), + }, { "no archive", args{