qrz/ci-build.sh
Paul Lecuq 1e331089b4
All checks were successful
continuous-integration/drone/push Build is passing
updated ci-build.sh
2020-05-09 19:30:28 +02:00

55 lines
832 B
Bash
Executable File

#!/bin/bash
PROJECTNAME=qrz
RELEASENAME=${PROJECTNAME}
VERSION="0"
GOOPTIONS="-mod=vendor"
SRCFILES=cmd/qrz/*.go
build() {
if [[ ! -z $DRONE_TAG ]]
then
VERSION=$DRONE_TAG
elif [[ ! -z $DRONE_TAG ]]
then
VERSION=$DRONE_COMMIT
fi
if [[ ! -z $VERSION && ! -z $GOOS && ! -z $GOARCH ]]
then
RELEASENAME=${PROJECTNAME}-${VERSION}-${GOOS}-${GOARCH}
fi
go get github.com/gobuffalo/packr/v2/packr2
if [[ ! -f ${GOPATH}/bin/packr2 ]]
then
${GOPATH}/bin/${GOOS}_${GOARCH}/packr2
else
${GOPATH}/bin/packr2
fi
go build -o ${PROJECTNAME} ${GOOPTIONS} ${SRCFILES}
if [[ ! -z $DRONE_TAG ]]
then
tar -czvf ${RELEASENAME}.tar.gz ${PROJECTNAME}
fi
rm ${PROJECTNAME}
}
clean() {
rm -rf $RELEASEDIR
}
case $1 in
"build")
build
;;
"clean")
clean
;;
*)
;;
esac