Skip to content

Commit

Permalink
release: fix adding libgeos files to .tar.gz and compress .zip
Browse files Browse the repository at this point in the history
* Fix issue where only the first file was added to a .tar.gz.
* Compress files better when adding to zips.

Release note: None
  • Loading branch information
otan authored and Nathan Stilwell committed Aug 24, 2020
1 parent 6ff42f2 commit 2c6646c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ func PutRelease(svc S3Putter, o PutReleaseOptions) {
log.Fatal(err)
}
zipHeader.Name = filepath.Join(targetArchiveBase, f.ArchiveFilePath)
zipHeader.Method = zip.Deflate

zfw, err := zw.CreateHeader(zipHeader)
if err != nil {
Expand All @@ -435,8 +436,8 @@ func PutRelease(svc S3Putter, o PutReleaseOptions) {
}
} else {
gzw := gzip.NewWriter(&body)
tw := tar.NewWriter(gzw)
for _, f := range o.Files {
tw := tar.NewWriter(gzw)

file, err := os.Open(f.LocalAbsolutePath)
if err != nil {
Expand All @@ -462,9 +463,9 @@ func PutRelease(svc S3Putter, o PutReleaseOptions) {
if _, err := io.Copy(tw, file); err != nil {
log.Fatal(err)
}
if err := tw.Close(); err != nil {
log.Fatal(err)
}
}
if err := tw.Close(); err != nil {
log.Fatal(err)
}
if err := gzw.Close(); err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 2c6646c

Please sign in to comment.