1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-04 03:11:55 +02:00

feat: --skip=winget

This commit is contained in:
Carlos Alexandro Becker 2023-11-03 23:23:25 +00:00
parent 8ce439972a
commit c6cb980c4f
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 6 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import (
"github.com/goreleaser/goreleaser/internal/client" "github.com/goreleaser/goreleaser/internal/client"
"github.com/goreleaser/goreleaser/internal/commitauthor" "github.com/goreleaser/goreleaser/internal/commitauthor"
"github.com/goreleaser/goreleaser/internal/pipe" "github.com/goreleaser/goreleaser/internal/pipe"
"github.com/goreleaser/goreleaser/internal/skips"
"github.com/goreleaser/goreleaser/internal/tmpl" "github.com/goreleaser/goreleaser/internal/tmpl"
"github.com/goreleaser/goreleaser/pkg/config" "github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context" "github.com/goreleaser/goreleaser/pkg/context"
@ -48,7 +49,7 @@ type Pipe struct{}
func (Pipe) String() string { return "winget" } func (Pipe) String() string { return "winget" }
func (Pipe) ContinueOnError() bool { return true } func (Pipe) ContinueOnError() bool { return true }
func (p Pipe) Skip(ctx *context.Context) bool { func (p Pipe) Skip(ctx *context.Context) bool {
return len(ctx.Config.Winget) == 0 return skips.Any(ctx, skips.Winget) || len(ctx.Config.Winget) == 0
} }
func (Pipe) Default(ctx *context.Context) error { func (Pipe) Default(ctx *context.Context) error {

View File

@ -11,6 +11,7 @@ import (
"github.com/goreleaser/goreleaser/internal/artifact" "github.com/goreleaser/goreleaser/internal/artifact"
"github.com/goreleaser/goreleaser/internal/client" "github.com/goreleaser/goreleaser/internal/client"
"github.com/goreleaser/goreleaser/internal/golden" "github.com/goreleaser/goreleaser/internal/golden"
"github.com/goreleaser/goreleaser/internal/skips"
"github.com/goreleaser/goreleaser/internal/testctx" "github.com/goreleaser/goreleaser/internal/testctx"
"github.com/goreleaser/goreleaser/pkg/config" "github.com/goreleaser/goreleaser/pkg/config"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -27,6 +28,7 @@ func TestString(t *testing.T) {
func TestSkip(t *testing.T) { func TestSkip(t *testing.T) {
t.Run("should", func(t *testing.T) { t.Run("should", func(t *testing.T) {
require.True(t, Pipe{}.Skip(testctx.New())) require.True(t, Pipe{}.Skip(testctx.New()))
require.True(t, Pipe{}.Skip(testctx.New(testctx.Skip(skips.Winget))))
}) })
t.Run("should not", func(t *testing.T) { t.Run("should not", func(t *testing.T) {
require.False(t, Pipe{}.Skip(testctx.NewWithCfg(config.Project{ require.False(t, Pipe{}.Skip(testctx.NewWithCfg(config.Project{

View File

@ -23,6 +23,7 @@ const (
Ko Key = "ko" Ko Key = "ko"
Docker Key = "docker" Docker Key = "docker"
Before Key = "before" Before Key = "before"
Winget Key = "winget"
Scoop Key = "scoop" Scoop Key = "scoop"
) )
@ -98,6 +99,7 @@ var Release = Keys{
SBOM, SBOM,
Ko, Ko,
Docker, Docker,
Winget,
Scoop, Scoop,
Before, Before,
} }