Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass correct compiler flags to go build for the release #1362

Merged
merged 10 commits into from
Jul 20, 2022
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- main
# Push events to branches matching refs/heads/release/**
- "release/**"
- ishustava/fix-release-build

env:
PKG_NAME: "consul-k8s"
Expand Down Expand Up @@ -109,6 +110,13 @@ jobs:
working-directory: ${{ matrix.component }}
run: |
mkdir -p dist out

export GIT_COMMIT=$(git rev-parse --short HEAD)
export GIT_DIRTY=$(test -n "$(git status --porcelain)" && echo "+CHANGES")
export GIT_DESCRIBE=$(git describe --tags --always)
export GIT_IMPORT=github.com/hashicorp/consul-k8s/${{ matrix.component }}/version
export GOLDFLAGS="-X ${GIT_IMPORT}.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X ${GIT_IMPORT}.GitDescribe=${GIT_DESCRIBE}"

CGO_ENABLED=0 go build -o dist/${{ matrix.bin_name }} .
zip -r -j out/${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/

Expand Down