use build outputs
This commit is contained in:
32
.github/workflows/binary-build.yml
vendored
32
.github/workflows/binary-build.yml
vendored
@@ -9,9 +9,23 @@ on:
|
|||||||
- latest
|
- latest
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
determine_version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
build_version: ${{ steps.set_version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- id: set_version
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
|
||||||
|
else
|
||||||
|
echo "::set-output name=version::latest"
|
||||||
|
fi
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: determine_version
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
goos: [windows, darwin, linux]
|
goos: [windows, darwin, linux]
|
||||||
@@ -31,17 +45,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: 'stable'
|
go-version: 'stable'
|
||||||
|
|
||||||
- name: Determine version/tag
|
|
||||||
run: |
|
|
||||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
||||||
echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "BUILD_VERSION=latest" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o zurg-${BUILD_VERSION}-${{ matrix.goos }}-${{ matrix.goarch }} cmd/zurg/main.go
|
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o zurg-${{ needs.determine_version.outputs.build_version }}-${{ matrix.goos }}-${{ matrix.goarch }} cmd/zurg/main.go
|
||||||
|
|
||||||
# Install and use UPX to compress the binary, but exclude specific combinations
|
# Install and use UPX to compress the binary, but exclude specific combinations
|
||||||
- name: Install and Compress with UPX
|
- name: Install and Compress with UPX
|
||||||
@@ -49,12 +55,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y upx-ucl
|
sudo apt-get install -y upx-ucl
|
||||||
upx --best zurg-${BUILD_VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}
|
upx --best zurg-${{ needs.determine_version.outputs.build_version }}-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||||
|
|
||||||
# Zip the binary
|
# Zip the binary
|
||||||
- name: Zip Binary
|
- name: Zip Binary
|
||||||
run: |
|
run: |
|
||||||
zip zurg-${BUILD_VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}.zip zurg-${BUILD_VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}
|
zip zurg-${{ needs.determine_version.outputs.build_version }}-${{ matrix.goos }}-${{ matrix.goarch }}.zip zurg-${{ needs.determine_version.outputs.build_version }}-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||||
|
|
||||||
# List files (for debugging)
|
# List files (for debugging)
|
||||||
- name: List files
|
- name: List files
|
||||||
@@ -63,5 +69,5 @@ jobs:
|
|||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: zurg-${BUILD_VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}.zip
|
name: zurg-${{ needs.determine_version.outputs.build_version }}-${{ matrix.goos }}-${{ matrix.goarch }}.zip
|
||||||
path: zurg-${BUILD_VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}.zip
|
path: zurg-${{ needs.determine_version.outputs.build_version }}-${{ matrix.goos }}-${{ matrix.goarch }}.zip
|
||||||
|
|||||||
Reference in New Issue
Block a user