diff --git a/.gitea/workflows/tag-build-artifacts.yml b/.gitea/workflows/tag-build-artifacts.yml index 9cf41af..f5c7ecf 100644 --- a/.gitea/workflows/tag-build-artifacts.yml +++ b/.gitea/workflows/tag-build-artifacts.yml @@ -39,11 +39,26 @@ jobs: cache: true cache-dependency-path: go.sum + - name: Install UPX + uses: crazy-max/ghaction-upx@v3 + with: + install-only: true + - name: Build binary run: | mkdir -p dist + output="dist/gosick_${{ matrix.goos }}_${{ matrix.goarch }}" GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=0 \ - go build -o dist/gosick_${{ matrix.goos }}_${{ matrix.goarch }} ./cmd/homesick + go build -o "$output" ./cmd/homesick + + - name: Compress binary with UPX + if: ${{ matrix.goos == 'linux' }} + run: | + set -euo pipefail + output="dist/gosick_${{ matrix.goos }}_${{ matrix.goarch }}" + if ! upx --best --lzma "$output"; then + echo "::warning::UPX compression failed for ${output}; continuing with uncompressed binary" + fi - name: Package artifact run: |