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

Use format: binary to skip archive

instead of a separate skip: true option.
This commit is contained in:
Jorin Vogel 2017-06-08 11:41:09 +02:00
parent feb6cbc86f
commit 24c50d804b
No known key found for this signature in database
GPG Key ID: 647AFD30D56CE8CC
10 changed files with 17 additions and 22 deletions

View File

@ -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

View File

@ -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"`

View File

@ -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)

View File

@ -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",
},
},
}

View File

@ -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")

View File

@ -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",
},
},
}

View File

@ -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)

View File

@ -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}}",
},
}

View File

@ -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")

View File

@ -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",
},
},
}