diff --git a/.github/workflows/binary-build.yml b/.github/workflows/binary-build.yml index 32a1424..f8b58dc 100644 --- a/.github/workflows/binary-build.yml +++ b/.github/workflows/binary-build.yml @@ -7,6 +7,7 @@ on: tags: - v0* - latest + jobs: build: name: Build @@ -32,18 +33,24 @@ jobs: - name: Build run: | - CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o zurg-${{ matrix.goos }}-${{ matrix.goarch }} cmd/zurg/main.go + CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o zurg-v${GITHUB_REF#refs/tags/}-${{ matrix.goos }}-${{ matrix.goarch }} cmd/zurg/main.go - # Install and use UPX to compress the binary + # Install and use UPX to compress the binary, but exclude windows/amd64 - name: Install and Compress with UPX + if: (matrix.goos != 'windows' && matrix.goarch != 'arm') || (matrix.goos != 'windows' && matrix.goarch != 'arm64') run: | sudo apt-get update sudo apt-get install -y upx-ucl - upx --best zurg-${{ matrix.goos }}-${{ matrix.goarch }} + upx --best zurg-v${GITHUB_REF#refs/tags/}-${{ matrix.goos }}-${{ matrix.goarch }} + + # Zip the binary + - name: Zip Binary + run: | + zip zurg-v${GITHUB_REF#refs/tags/}-${{ matrix.goos }}-${{ matrix.goarch }}.zip zurg-v${GITHUB_REF#refs/tags/}-${{ matrix.goos }}-${{ matrix.goarch }} - name: Upload Artifacts uses: actions/upload-artifact@v3 with: - name: zurg-${{ matrix.goos }}-${{ matrix.goarch }} + name: zurg-v${GITHUB_REF#refs/tags/}-${{ matrix.goos }}-${{ matrix.goarch }}.zip path: | - zurg-${{ matrix.goos }}-${{ matrix.goarch }} + zurg-v${GITHUB_REF#refs/tags/}-${{ matrix.goos }}-${{ matrix.goarch }}.zip