mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
feat: --skip=homebrew
This commit is contained in:
parent
954121ffb1
commit
0fbc447fe1
@ -19,6 +19,7 @@ import (
|
||||
"github.com/goreleaser/goreleaser/internal/commitauthor"
|
||||
"github.com/goreleaser/goreleaser/internal/deprecate"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||
"github.com/goreleaser/goreleaser/internal/skips"
|
||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||
"github.com/goreleaser/goreleaser/pkg/config"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
@ -44,9 +45,11 @@ func (e ErrNoArchivesFound) Error() string {
|
||||
// Pipe for brew deployment.
|
||||
type Pipe struct{}
|
||||
|
||||
func (Pipe) String() string { return "homebrew tap formula" }
|
||||
func (Pipe) ContinueOnError() bool { return true }
|
||||
func (Pipe) Skip(ctx *context.Context) bool { return len(ctx.Config.Brews) == 0 }
|
||||
func (Pipe) String() string { return "homebrew tap formula" }
|
||||
func (Pipe) ContinueOnError() bool { return true }
|
||||
func (Pipe) Skip(ctx *context.Context) bool {
|
||||
return skips.Any(ctx, skips.Homebrew) || len(ctx.Config.Brews) == 0
|
||||
}
|
||||
|
||||
func (Pipe) Default(ctx *context.Context) error {
|
||||
for i := range ctx.Config.Brews {
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/client"
|
||||
"github.com/goreleaser/goreleaser/internal/golden"
|
||||
"github.com/goreleaser/goreleaser/internal/skips"
|
||||
"github.com/goreleaser/goreleaser/internal/testctx"
|
||||
"github.com/goreleaser/goreleaser/internal/testlib"
|
||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||
@ -1227,7 +1228,14 @@ func TestSkip(t *testing.T) {
|
||||
t.Run("skip", func(t *testing.T) {
|
||||
require.True(t, Pipe{}.Skip(testctx.New()))
|
||||
})
|
||||
|
||||
t.Run("skip flag", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Brews: []config.Homebrew{
|
||||
{},
|
||||
},
|
||||
}, testctx.Skip(skips.Homebrew))
|
||||
require.False(t, Pipe{}.Skip(ctx))
|
||||
})
|
||||
t.Run("dont skip", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Brews: []config.Homebrew{
|
||||
|
@ -26,6 +26,7 @@ const (
|
||||
Winget Key = "winget"
|
||||
Snapcraft Key = "snapcraft"
|
||||
Scoop Key = "scoop"
|
||||
Homebrew Key = "homebrew"
|
||||
Nix Key = "nix"
|
||||
AUR Key = "aur"
|
||||
)
|
||||
@ -105,6 +106,7 @@ var Release = Keys{
|
||||
Winget,
|
||||
Snapcraft,
|
||||
Scoop,
|
||||
Homebrew,
|
||||
Nix,
|
||||
AUR,
|
||||
Before,
|
||||
|
Loading…
Reference in New Issue
Block a user