This now works for files added to the source archive **after** the `git
archive` command is run. During the `git archive`, it seems that the
`tar` is still using some format that doesn't support utf-8 by default.
Tomorrow I'll look more into it.
see https://pkg.go.dev/archive/tar#Formatcloses#3812
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-Authored-By: Mohammed Al Sahaf <msaa1990@gmail.com>
We support `.tar.gz` since the beginning, and `.tar.xz` for a long time.
`.tgz` and `.txz` are just commonly used shorthands for the same
formats.
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This reverts back to using `git archive` for the source archives... but
will keep supporting extra files.
##### How it works:
Basically, we run `git archive` as before.
Then, we make a backup of the generated archive, and create a new one
copying by reading from the backup and writing into the new one.
Finally, we write the extra files to the new one as well.
This only happens if the configuration does have extra files, otherwise,
just the simple `git archive` will be run.
PS: we can't just append to the archive because weird tar format
paddings et al.
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
this allows to template the owner, group and mtime in file infos inside
archives.
should help towards reproducible builds!
goes well with #3618
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
fixes#3584
When following the reproduction steps in #3584 I now get the following
contents for the zip archive:
```
$ goreleaser --snapshot --skip-publish
...
$ (mkdir thezip && cd thezip && unzip ../dist/test_0.0.0-SNAPSHOT-none_darwin_amd64.zip) && ls -lR thezip
Archive: ../dist/test_0.0.0-SNAPSHOT-none_darwin_amd64.zip
inflating: a/x -> ../x
inflating: a/x2 -> x
inflating: x
inflating: test
finishing deferred symbolic links:
a/x -> ../x
a/x2 -> x
total 1640
drwxr-xr-x 4 orawlings staff 128 Nov 22 16:19 a
-rwxr-xr-x 1 orawlings staff 833104 Nov 22 16:19 test
-rw-r--r-- 1 orawlings staff 2 Nov 22 15:32 x
thezip/a:
total 0
lrwxr-xr-x 1 orawlings staff 4 Nov 22 16:19 x -> ../x
lrwxr-xr-x 1 orawlings staff 1 Nov 22 16:19 x2 -> x
```
<!-- Why is this change being made? -->
I'm using goreleaser for a project that packages multiple binaries in
zip archives. We also include symlinks within the zip archives to give
some of the binaries an alternate (usually shorter) spelling so they are
easier to invoke on the command line.
This brings the zip archive behavior regarding symlinks in line with
tar.gz and tar archives.
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
* refactor: archive files
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* feat: better archives
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* feat: better archives
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: test todos
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: go mod tidy et al
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: improve docs and remove typoe 'licence' from defaults
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: fixes
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: error string
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: remove some logs
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: use utc
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* refactor: use t.Cleanup instead of defer
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* refactor: use t.Cleanup instead of defer
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* refactor: use t.Cleanup instead of defer
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* refactor: use t.Cleanup instead of defer
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: filepath
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* refactor: use require on all tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* refactor: use require on all tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* chore(deps): bump github.com/golangci/golangci-lint from 1.23.7 to 1.27.0
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* feat: xz compression
* remove .xz feature
* fix: format code with gofmt
* use larger dict for better compression
* Update pkg/archive/tarxz/tarxz.go
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* feat: use maximum compression for gzip and zip archives
* fix: add comment for skipping error check
Co-authored-by: John Taylor <ec2-user@ip-172-31-29-117.ap-south-1.compute.internal>
* refactor: merging archive in the same repo
* refactor: merging archive in the same repo
* refactor: better organizing packages
* refactor: fixing renames
* fix: new dep version
* fix: makefile
* fix: zip/tar tests
* fix: gitigonore
* fix: s3 tests
* fix: archive test