1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00

feat: --skip-nix

This commit is contained in:
Carlos Alexandro Becker 2023-11-03 23:31:25 +00:00
parent 53071b6642
commit 954121ffb1
3 changed files with 10 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import (
"github.com/goreleaser/goreleaser/internal/client"
"github.com/goreleaser/goreleaser/internal/commitauthor"
"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"
@ -64,7 +65,7 @@ func (Pipe) String() string { return "nixpkgs" }
func (Pipe) ContinueOnError() bool { return true }
func (Pipe) Dependencies(_ *context.Context) []string { return []string{"nix-prefetch-url"} }
func (p Pipe) Skip(ctx *context.Context) bool {
return len(ctx.Config.Nix) == 0 || !p.prefetcher.Available()
return skips.Any(ctx, skips.Nix) || len(ctx.Config.Nix) == 0 || !p.prefetcher.Available()
}
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/client"
"github.com/goreleaser/goreleaser/internal/golden"
"github.com/goreleaser/goreleaser/internal/skips"
"github.com/goreleaser/goreleaser/internal/testctx"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/stretchr/testify/require"
@ -28,6 +29,11 @@ func TestSkip(t *testing.T) {
t.Run("no-nix", func(t *testing.T) {
require.True(t, Pipe{}.Skip(testctx.New()))
})
t.Run("skip flag", func(t *testing.T) {
require.False(t, NewPublish().Skip(testctx.NewWithCfg(config.Project{
Nix: []config.Nix{{}},
}, testctx.Skip(skips.Nix))))
})
t.Run("nix-all-good", func(t *testing.T) {
require.False(t, NewPublish().Skip(testctx.NewWithCfg(config.Project{
Nix: []config.Nix{{}},

View File

@ -26,6 +26,7 @@ const (
Winget Key = "winget"
Snapcraft Key = "snapcraft"
Scoop Key = "scoop"
Nix Key = "nix"
AUR Key = "aur"
)
@ -104,6 +105,7 @@ var Release = Keys{
Winget,
Snapcraft,
Scoop,
Nix,
AUR,
Before,
}