diff --git a/internal/pipe/nfpm/nfpm.go b/internal/pipe/nfpm/nfpm.go index bc4478854..721ef959f 100644 --- a/internal/pipe/nfpm/nfpm.go +++ b/internal/pipe/nfpm/nfpm.go @@ -37,8 +37,10 @@ const ( // Pipe for nfpm packaging. type Pipe struct{} -func (Pipe) String() string { return "linux packages" } -func (Pipe) Skip(ctx *context.Context) bool { return len(ctx.Config.NFPMs) == 0 } +func (Pipe) String() string { return "linux packages" } +func (Pipe) Skip(ctx *context.Context) bool { + return skips.Any(ctx, skips.NFPM) || len(ctx.Config.NFPMs) == 0 +} // Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { diff --git a/internal/pipe/nfpm/nfpm_test.go b/internal/pipe/nfpm/nfpm_test.go index 577d3dd19..47703cf2c 100644 --- a/internal/pipe/nfpm/nfpm_test.go +++ b/internal/pipe/nfpm/nfpm_test.go @@ -1407,6 +1407,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{ + NFPMs: []config.NFPM{ + {}, + }, + }, testctx.Skip(skips.NFPM)) + require.True(t, Pipe{}.Skip(ctx)) + }) t.Run("dont skip", func(t *testing.T) { ctx := testctx.NewWithCfg(config.Project{ diff --git a/internal/skips/skips.go b/internal/skips/skips.go index ee21eb8f5..f27cf40c0 100644 --- a/internal/skips/skips.go +++ b/internal/skips/skips.go @@ -29,6 +29,7 @@ const ( Homebrew Key = "homebrew" Nix Key = "nix" AUR Key = "aur" + NFPM Key = "nfpm" ) func String(ctx *context.Context) string { @@ -109,6 +110,7 @@ var Release = Keys{ Homebrew, Nix, AUR, + NFPM, Before, }