mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
parent
4e699a4caf
commit
11aa7cfceb
@ -34,7 +34,11 @@ func (Pipe) String() string {
|
||||
func (Pipe) Run(ctx *context.Context) error {
|
||||
g := semerrgroup.New(ctx.Parallelism)
|
||||
for _, build := range ctx.Config.Builds {
|
||||
if build.Skip {
|
||||
skip, err := tmpl.New(ctx).Bool(build.Skip)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skip {
|
||||
log.WithField("id", build.ID).Info("skip is set")
|
||||
continue
|
||||
}
|
||||
|
@ -405,7 +405,23 @@ func TestSkipBuild(t *testing.T) {
|
||||
Dist: folder,
|
||||
Builds: []config.Build{
|
||||
{
|
||||
Skip: true,
|
||||
Skip: "true",
|
||||
},
|
||||
},
|
||||
}
|
||||
ctx := testctx.NewWithCfg(config, testctx.WithCurrentTag("2.4.5"))
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
require.Empty(t, ctx.Artifacts.List())
|
||||
}
|
||||
|
||||
func TestSkipBuildTmpl(t *testing.T) {
|
||||
folder := testlib.Mktmp(t)
|
||||
config := config.Project{
|
||||
Dist: folder,
|
||||
Env: []string{"FOO=bar"},
|
||||
Builds: []config.Build{
|
||||
{
|
||||
Skip: "{{ eq .Env.FOO \"bar\" }}",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ type Build struct {
|
||||
Hooks BuildHookConfig `yaml:"hooks,omitempty" json:"hooks,omitempty"`
|
||||
Builder string `yaml:"builder,omitempty" json:"builder,omitempty"`
|
||||
ModTimestamp string `yaml:"mod_timestamp,omitempty" json:"mod_timestamp,omitempty"`
|
||||
Skip bool `yaml:"skip,omitempty" json:"skip,omitempty"`
|
||||
Skip string `yaml:"skip,omitempty" json:"skip,omitempty" jsonschema:"oneof_type=string;boolean"`
|
||||
GoBinary string `yaml:"gobinary,omitempty" json:"gobinary,omitempty"`
|
||||
Command string `yaml:"command,omitempty" json:"command,omitempty"`
|
||||
NoUniqueDistDir bool `yaml:"no_unique_dist_dir,omitempty" json:"no_unique_dist_dir,omitempty"`
|
||||
|
@ -194,6 +194,8 @@ builds:
|
||||
|
||||
# If true, skip the build.
|
||||
# Useful for library projects.
|
||||
#
|
||||
# Templates: allowed (since v2.3).
|
||||
skip: false
|
||||
|
||||
# By default, GoReleaser will create your binaries inside
|
||||
|
Loading…
x
Reference in New Issue
Block a user