From 0a721bdfffe3365001ffee9838a95d994fd3fd6a Mon Sep 17 00:00:00 2001 From: appleboy Date: Sat, 6 May 2023 07:57:07 +0800 Subject: [PATCH] build: optimize binary size and improve test accuracy - Add a post-build hook to compress the generated binary with `xz` at level 9 compression Signed-off-by: appleboy --- .goreleaser.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b91f731..8306551 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -71,6 +71,10 @@ builds: {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}-{{ .Arm }}{{ end }} no_unique_dist_dir: true + hooks: + post: + - cmd: xz -k -9 {{ .Path }} + dir: ./dist/ archives: - format: binary