diff --git a/README.md b/README.md index e4ff897d0..c68c90a12 100644 --- a/README.md +++ b/README.md @@ -250,12 +250,6 @@ build: ```yml # goreleaser.yml archive: - # If set, no archives are created and the binaries are instead uploaded directly. - # In that case name_template is used to name the binary - # and the below specified files are ignored. - # Default is false - skip: true - # You can change the name of the archive. # This is parsed with Golang template engine and the following variables # are available: @@ -268,7 +262,9 @@ archive: # The default is `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}` name_template: "{{.Binary}}_{{.Version}}_{{.Os}}_{{.Arch}}" - # Archive format. Valid options are `tar.gz` and `zip`. + # Archive format. Valid options are `tar.gz`, `zip` and `binary`. + # If format is `binary` no archives are created and the binaries are instead uploaded directly. + # In that case name_template the below specified files are ignored. # Default is `tar.gz` format: zip diff --git a/config/config.go b/config/config.go index baf9af937..1db76a004 100644 --- a/config/config.go +++ b/config/config.go @@ -67,7 +67,6 @@ type FormatOverride struct { // Archive config used for the archive type Archive struct { - Skip bool `yaml:",omitempty"` Format string `yaml:",omitempty"` FormatOverrides []FormatOverride `yaml:"format_overrides,omitempty"` NameTemplate string `yaml:"name_template,omitempty"` diff --git a/pipeline/archive/archive.go b/pipeline/archive/archive.go index 24ee355c1..81eac530b 100644 --- a/pipeline/archive/archive.go +++ b/pipeline/archive/archive.go @@ -32,7 +32,7 @@ func (Pipe) Run(ctx *context.Context) error { archive := archive platform := platform g.Go(func() error { - if ctx.Config.Archive.Skip { + if ctx.Config.Archive.Format == "binary" { return skip(ctx, platform, archive) } return create(ctx, platform, archive) diff --git a/pipeline/archive/archive_test.go b/pipeline/archive/archive_test.go index 959732743..1cbb2eaf6 100644 --- a/pipeline/archive/archive_test.go +++ b/pipeline/archive/archive_test.go @@ -65,7 +65,7 @@ func TestRunPipe(t *testing.T) { } } -func TestRunPipeSkip(t *testing.T) { +func TestRunPipeBinary(t *testing.T) { var assert = assert.New(t) folder, err := ioutil.TempDir("", "archivetest") assert.NoError(err) @@ -95,7 +95,7 @@ func TestRunPipeSkip(t *testing.T) { Binary: "mybin", }, Archive: config.Archive{ - Skip: true, + Format: "binary", }, }, } diff --git a/pipeline/brew/brew.go b/pipeline/brew/brew.go index b9858b2db..a2e9eee53 100644 --- a/pipeline/brew/brew.go +++ b/pipeline/brew/brew.go @@ -106,8 +106,8 @@ func doRun(ctx *context.Context, client client.Client) error { log.Println("Skipped because release is marked as draft") return nil } - if ctx.Config.Archive.Skip { - log.Println("Skipped because archiving is skipped") + if ctx.Config.Archive.Format == "binary" { + log.Println("Skipped because archive format is binary") return nil } path := filepath.Join(ctx.Config.Brew.Folder, ctx.Config.Build.Binary+".rb") diff --git a/pipeline/brew/brew_test.go b/pipeline/brew/brew_test.go index 025255018..a0a4326fe 100644 --- a/pipeline/brew/brew_test.go +++ b/pipeline/brew/brew_test.go @@ -186,12 +186,12 @@ func TestRunPipeDraftRelease(t *testing.T) { assert.False(client.CreatedFile) } -func TestRunPipeSkipArchive(t *testing.T) { +func TestRunPipeFormatBinary(t *testing.T) { assert := assert.New(t) var ctx = &context.Context{ Config: config.Project{ Archive: config.Archive{ - Skip: true, + Format: "binary", }, }, } diff --git a/pipeline/build/build.go b/pipeline/build/build.go index c57806d25..e87cb335e 100644 --- a/pipeline/build/build.go +++ b/pipeline/build/build.go @@ -67,7 +67,7 @@ func build(ctx *context.Context, name string, target buildTarget) error { name, ctx.Config.Build.Binary+ext.For(target.goos), ) - if ctx.Config.Archive.Skip { + if ctx.Config.Archive.Format == "binary" { output = filepath.Join(ctx.Config.Dist, name+ext.For(target.goos)) } log.Println("Building", output) diff --git a/pipeline/build/build_test.go b/pipeline/build/build_test.go index 8743663de..d86170fb9 100644 --- a/pipeline/build/build_test.go +++ b/pipeline/build/build_test.go @@ -76,7 +76,7 @@ func TestRunFullPipe(t *testing.T) { assert.True(exists(post), post) } -func TestRunPipeSkipArchive(t *testing.T) { +func TestRunPipeFormatBinary(t *testing.T) { assert := assert.New(t) folder, err := ioutil.TempDir("", "goreleasertest") assert.NoError(err) @@ -93,7 +93,7 @@ func TestRunPipeSkipArchive(t *testing.T) { }, }, Archive: config.Archive{ - Skip: true, + Format: "binary", NameTemplate: "binary-{{.Binary}}", }, } diff --git a/pipeline/fpm/fpm.go b/pipeline/fpm/fpm.go index cd0ce8fc5..771919841 100644 --- a/pipeline/fpm/fpm.go +++ b/pipeline/fpm/fpm.go @@ -33,8 +33,8 @@ func (Pipe) Run(ctx *context.Context) error { log.Println("No output formats configured, skipping") return nil } - if ctx.Config.Archive.Skip { - log.Println("Skipped because archiving is skipped") + if ctx.Config.Archive.Format == "binary" { + log.Println("Skipped because archive format is binary") return nil } _, err := exec.LookPath("fpm") diff --git a/pipeline/fpm/fpm_test.go b/pipeline/fpm/fpm_test.go index 60f1a5f8c..156d07104 100644 --- a/pipeline/fpm/fpm_test.go +++ b/pipeline/fpm/fpm_test.go @@ -23,12 +23,12 @@ func TestRunPipeNoFormats(t *testing.T) { assert.NoError(Pipe{}.Run(ctx)) } -func TestRunPipeSkipArchive(t *testing.T) { +func TestRunPipeFormatBinary(t *testing.T) { var assert = assert.New(t) var ctx = &context.Context{ Config: config.Project{ Archive: config.Archive{ - Skip: true, + Format: "binary", }, }, }