mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-05 13:15:26 +02:00
feat: allow to disable archive binary count check (#1856)
closes #1855 Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
e3a408bf1e
commit
ff2495fbd1
@ -97,7 +97,7 @@ func (Pipe) Run(ctx *context.Context) error {
|
||||
artifact.ByIDs(archive.Builds...),
|
||||
),
|
||||
).GroupByPlatform()
|
||||
if err := checkArtifacts(artifacts); err != nil {
|
||||
if err := checkArtifacts(artifacts); err != nil && !archive.AllowDifferentBinaryCount {
|
||||
return fmt.Errorf("invalid archive: %d: %w", i, ErrArchiveDifferentBinaryCount)
|
||||
}
|
||||
for group, artifacts := range artifacts {
|
||||
|
@ -241,7 +241,16 @@ func TestRunPipeDifferentBinaryCount(t *testing.T) {
|
||||
ctx.Artifacts.Add(linuxArmBuild)
|
||||
ctx.Version = "0.0.1"
|
||||
ctx.Git.CurrentTag = "v0.0.1"
|
||||
require.EqualError(t, Pipe{}.Run(ctx), "invalid archive: 0: "+ErrArchiveDifferentBinaryCount.Error())
|
||||
|
||||
t.Run("check enabled", func(t *testing.T) {
|
||||
ctx.Config.Archives[0].AllowDifferentBinaryCount = false
|
||||
require.EqualError(t, Pipe{}.Run(ctx), "invalid archive: 0: "+ErrArchiveDifferentBinaryCount.Error())
|
||||
})
|
||||
|
||||
t.Run("check disabled", func(t *testing.T) {
|
||||
ctx.Config.Archives[0].AllowDifferentBinaryCount = true
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
})
|
||||
}
|
||||
|
||||
func TestRunPipeNoBinaries(t *testing.T) {
|
||||
|
@ -261,14 +261,15 @@ type FormatOverride struct {
|
||||
|
||||
// Archive config used for the archive.
|
||||
type Archive struct {
|
||||
ID string `yaml:",omitempty"`
|
||||
Builds []string `yaml:",omitempty"`
|
||||
NameTemplate string `yaml:"name_template,omitempty"`
|
||||
Replacements map[string]string `yaml:",omitempty"`
|
||||
Format string `yaml:",omitempty"`
|
||||
FormatOverrides []FormatOverride `yaml:"format_overrides,omitempty"`
|
||||
WrapInDirectory string `yaml:"wrap_in_directory,omitempty"`
|
||||
Files []string `yaml:",omitempty"`
|
||||
ID string `yaml:",omitempty"`
|
||||
Builds []string `yaml:",omitempty"`
|
||||
NameTemplate string `yaml:"name_template,omitempty"`
|
||||
Replacements map[string]string `yaml:",omitempty"`
|
||||
Format string `yaml:",omitempty"`
|
||||
FormatOverrides []FormatOverride `yaml:"format_overrides,omitempty"`
|
||||
WrapInDirectory string `yaml:"wrap_in_directory,omitempty"`
|
||||
Files []string `yaml:",omitempty"`
|
||||
AllowDifferentBinaryCount bool `yaml:"allow_different_binary_count"`
|
||||
}
|
||||
|
||||
// Release config used for the GitHub/GitLab release.
|
||||
|
@ -69,6 +69,10 @@ archives:
|
||||
- docs/*
|
||||
- design/*.png
|
||||
- templates/**/*
|
||||
|
||||
# Disables the binary count check.
|
||||
# Default: false
|
||||
allow_different_binary_count: true
|
||||
```
|
||||
|
||||
!!! tip
|
||||
|
Loading…
x
Reference in New Issue
Block a user