mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
25 lines
634 B
Bash
Executable File
25 lines
634 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
BUILD_TIME=`date -u +'%Y-%m-%dT%H:%M:%SZ'`
|
|
|
|
#
|
|
# set git build variables if git exists
|
|
if git status > /dev/null 2>&1 && [ -z $GIT_COMMIT ] && [ -z $GIT_BRANCH ] && [ -z $GIT_DIRTY ];
|
|
then
|
|
GIT_COMMIT=`git rev-parse --short HEAD`
|
|
GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
|
|
GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"`
|
|
fi
|
|
|
|
go build \
|
|
-o bin/neko \
|
|
-ldflags "
|
|
-s -w
|
|
-X 'm1k1o/neko.buildDate=${BUILD_TIME}'
|
|
-X 'm1k1o/neko.gitCommit=${GIT_DIRTY}${GIT_COMMIT}'
|
|
-X 'm1k1o/neko.gitBranch=${GIT_BRANCH}'
|
|
" \
|
|
cmd/neko/main.go;
|