From f19d6e5d2bef8a8ceca2b7d77ec447fc304f8078 Mon Sep 17 00:00:00 2001 From: Dustin Decker Date: Wed, 5 Feb 2025 13:33:44 -0800 Subject: [PATCH] Compress release with UPX (#3456) * Compress release with UPX * Allow UPX to fail, and use goreleaser-pro * update --- .github/workflows/release.yml | 7 ++++++- .goreleaser.yml | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 33c86fd6a..6b6a9bba6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,12 +39,17 @@ jobs: go-version: "1.23" - name: Cosign install uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0 + - name: Install UPX + run: | + sudo apt-get update + sudo apt-get install -y upx - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: - distribution: goreleaser + distribution: goreleaser-pro version: latest args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} diff --git a/.goreleaser.yml b/.goreleaser.yml index e951f9579..b7b354462 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,13 +1,26 @@ version: 2 builds: - - binary: trufflehog + - id: trufflehog-upx + binary: trufflehog ldflags: - -s -w -X 'github.com/trufflesecurity/trufflehog/v3/pkg/version.BuildVersion={{ .Version }}' env: [CGO_ENABLED=0] goos: - linux - - windows + goarch: + - amd64 + - arm64 + hooks: + post: + - upx -q "{{ .Path }}" + - id: trufflehog + binary: trufflehog + ldflags: + - -X 'github.com/trufflesecurity/trufflehog/v3/pkg/version.BuildVersion={{ .Version }}' + env: [CGO_ENABLED=0] + goos: - darwin + - windows goarch: - amd64 - arm64