diff --git a/.goreleaser.yml b/.goreleaser.yml index 26149bb..acf45ec 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -39,7 +39,7 @@ builds: - goos: darwin goarch: arm hooks: - post: ./upx.sh + post: ./upx.sh {{.ProjectName}} archives: - id: binary name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' diff --git a/upx.sh b/upx.sh index 85589cb..83e1c57 100755 --- a/upx.sh +++ b/upx.sh @@ -1,5 +1,5 @@ #!/bin/bash set -euo pipefail - -find dist/ -type f -iname 'gosuv*' | xargs -I{} -n1 -P 4 upx --best "{}" +binaryName="$1" +find dist/ -type f -iname "${binaryName}*" | xargs -I{} -n1 -P 4 upx --best "{}"