From f13f61592c4daf01957c7c72d9f9cd41d3bb968f Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Fri, 10 Feb 2023 11:11:40 +0700 Subject: [PATCH] Add upx to goreleaser builds Reducing the size of the final binaries, except for darwin, where the packed binaries failed to run. --- .goreleaser.yaml | 2 ++ scripts/upx.sh | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100755 scripts/upx.sh diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 95b5867..de268bc 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -25,6 +25,8 @@ builds: gomips: - softfloat main: ./cmd/ctrld + hooks: + post: /bin/sh ./scripts/upx.sh archives: - format_overrides: - goos: windows diff --git a/scripts/upx.sh b/scripts/upx.sh new file mode 100755 index 0000000..55c60e7 --- /dev/null +++ b/scripts/upx.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -ex + +for dist_dir in ./dist/ctrld*; do + upx --brute "${dist_dir}/ctrld" +done