Last active
August 1, 2016 22:02
-
-
Save yasarix/97ccfe207e57ee4693518edaa6c70528 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -n "$CI_BUILD_REF_NAME" ]; then | |
branch_name=$CI_BUILD_REF_NAME | |
else | |
branch_name=$(git symbolic-ref -q HEAD) | |
branch_name=${branch_name##refs/heads/} | |
branch_name=${branch_name:-HEAD} | |
fi | |
DATEINFO=`date -u +%Y%m%d.%H%M%S` | |
build_info="$branch_name-$USER-$DATEINFO" | |
if [ -n "$CI_BUILD_ID" ]; then | |
BUILD_NUMBER=$CI_BUILD_ID | |
fi | |
if [ -n "$BUILD_NUMBER" ]; then | |
build_info="$build_info-build-$BUILD_NUMBER" | |
fi | |
go build -v -ldflags "-X main.BuildInfo=$build_info" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment