1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-06 03:13:48 +02:00

fix brew and scoop for disabled release (#1128)

* fix: mod tidy

* fix: skips brew pipe if release is disabled

* fix: skips scoop pipe if release is disabled

* fix: mod tidy
This commit is contained in:
Manuel Vogel 2019-08-29 01:34:09 +02:00 committed by Carlos Alexandro Becker
parent aae3236121
commit 2da118a296
4 changed files with 52 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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