Set version.Version to the actual version at build time
set -euo pipefail
-BASEDIR="$(cd "$(dirname "$0")/.." && pwd)"
+GIT_ROOT=${GIT_ROOT:-$(git rev-parse --show-toplevel)}
+. "${GIT_ROOT}/bin/include/versioning"
-CGO_ENABLED=0 go build -o "${BASEDIR}/binaries/cf-operator" cmd/cf-operator/main.go
+BASEDIR="$(cd "$(dirname "$0")/.." && pwd)"
+CGO_ENABLED=0 go build -o "${BASEDIR}/binaries/cf-operator" -ldflags="-X code.cloudfoundry.org/cf-operator/version.Version=${ARTIFACT_VERSION}" cmd/cf-operator/main.go
