1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-03 13:11:48 +02:00

feat: allow to use .tar as archive format

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2021-08-31 23:09:18 -03:00
parent 8858049a28
commit 990fb63aef
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
5 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import (
"strings"
"github.com/goreleaser/goreleaser/pkg/archive/gzip"
"github.com/goreleaser/goreleaser/pkg/archive/tar"
"github.com/goreleaser/goreleaser/pkg/archive/targz"
"github.com/goreleaser/goreleaser/pkg/archive/tarxz"
"github.com/goreleaser/goreleaser/pkg/archive/zip"
@ -32,5 +33,8 @@ func New(file *os.File) Archive {
if strings.HasSuffix(file.Name(), ".zip") {
return zip.New(file)
}
if strings.HasSuffix(file.Name(), ".tar") {
return tar.New(file)
}
return targz.New(file)
}

View File

@ -15,7 +15,7 @@ func TestArchive(t *testing.T) {
require.NoError(t, empty.Close())
require.NoError(t, os.Mkdir(folder+"/folder-inside", 0o755))
for _, format := range []string{"tar.gz", "zip", "gz", "tar.xz", "willbeatargzanyway"} {
for _, format := range []string{"tar.gz", "zip", "gz", "tar.xz", "tar", "willbeatargzanyway"} {
format := format
t.Run(format, func(t *testing.T) {
file, err := os.Create(folder + "/folder." + format)

1
pkg/archive/testdata/badlink.txt vendored Symbolic link
View File

@ -0,0 +1 @@
regular3.txt

View File

@ -0,0 +1 @@
regular file

View File

@ -20,7 +20,7 @@ archives:
builds:
- default
# Archive format. Valid options are `tar.gz`, `tar.xz`, `gz`, `zip` and `binary`.
# Archive format. Valid options are `tar.gz`, `tar.xz`, `tar`, `gz`, `zip` and `binary`.
# If format is `binary`, no archives are created and the binaries are instead
# uploaded directly.
# Default is `tar.gz`.