2019-02-07 11:23:56 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-02-07 16:35:53 +08:00
|
|
|
# Check if any command failed
|
|
|
|
ERROR=false
|
|
|
|
|
2019-02-07 11:23:56 +08:00
|
|
|
GOARCH=${_GOARCH}
|
|
|
|
GOOS=${_GOOS}
|
|
|
|
|
|
|
|
if [[ ! ${GOARCH} ]]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2019-02-07 16:35:53 +08:00
|
|
|
env GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -o ${NAME} || ERROR=true
|
2019-02-07 11:23:56 +08:00
|
|
|
|
|
|
|
mkdir -p dist
|
|
|
|
|
|
|
|
if [[ ${GOARCH} == "arm64" ]]; then
|
|
|
|
FILE=${NAME}_${TRAVIS_BRANCH}_${GOOS}_arm8
|
|
|
|
else
|
|
|
|
FILE=${NAME}_${TRAVIS_BRANCH}_${GOOS}_${GOARCH}${GOARM}
|
|
|
|
fi
|
|
|
|
|
2019-02-07 16:35:53 +08:00
|
|
|
tar -czf dist/${FILE}.tgz ${NAME} || ERROR=true
|
2019-02-07 11:23:56 +08:00
|
|
|
|
|
|
|
if [[ ${GOOS} == "linux" && ${GOARCH} == "amd64" ]]; then
|
2019-02-08 06:06:40 +08:00
|
|
|
make all || ERROR=true
|
|
|
|
rm dist/gotop
|
2019-02-07 16:35:53 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${ERROR} == "true" ]; then
|
|
|
|
exit 1
|
2019-02-07 11:23:56 +08:00
|
|
|
fi
|