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

feat: --skip=nfpm

This commit is contained in:
Carlos Alexandro Becker 2024-01-07 23:16:24 -03:00
parent 90a1bbe8bb
commit 5e9f01e6ea
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 14 additions and 2 deletions

View File

@ -38,7 +38,9 @@ const (
type Pipe struct{} type Pipe struct{}
func (Pipe) String() string { return "linux packages" } func (Pipe) String() string { return "linux packages" }
func (Pipe) Skip(ctx *context.Context) bool { return len(ctx.Config.NFPMs) == 0 } func (Pipe) Skip(ctx *context.Context) bool {
return skips.Any(ctx, skips.NFPM) || len(ctx.Config.NFPMs) == 0
}
// Default sets the pipe defaults. // Default sets the pipe defaults.
func (Pipe) Default(ctx *context.Context) error { func (Pipe) Default(ctx *context.Context) error {

View File

@ -1407,6 +1407,14 @@ func TestSkip(t *testing.T) {
t.Run("skip", func(t *testing.T) { t.Run("skip", func(t *testing.T) {
require.True(t, Pipe{}.Skip(testctx.New())) require.True(t, Pipe{}.Skip(testctx.New()))
}) })
t.Run("skip flag", func(t *testing.T) {
ctx := testctx.NewWithCfg(config.Project{
NFPMs: []config.NFPM{
{},
},
}, testctx.Skip(skips.NFPM))
require.True(t, Pipe{}.Skip(ctx))
})
t.Run("dont skip", func(t *testing.T) { t.Run("dont skip", func(t *testing.T) {
ctx := testctx.NewWithCfg(config.Project{ ctx := testctx.NewWithCfg(config.Project{

View File

@ -29,6 +29,7 @@ const (
Homebrew Key = "homebrew" Homebrew Key = "homebrew"
Nix Key = "nix" Nix Key = "nix"
AUR Key = "aur" AUR Key = "aur"
NFPM Key = "nfpm"
) )
func String(ctx *context.Context) string { func String(ctx *context.Context) string {
@ -109,6 +110,7 @@ var Release = Keys{
Homebrew, Homebrew,
Nix, Nix,
AUR, AUR,
NFPM,
Before, Before,
} }