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:
parent
aae3236121
commit
2da118a296
@ -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")
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user