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:
parent
feb6cbc86f
commit
24c50d804b
10
README.md
10
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
|
||||
|
||||
|
@ -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"`
|
||||
|
@ -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)
|
||||
|
@ -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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -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")
|
||||
|
@ -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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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}}",
|
||||
},
|
||||
}
|
||||
|
@ -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")
|
||||
|
@ -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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user