44 lines
637 B
Bash
Executable File
44 lines
637 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 build -o ${RELEASENAME} ${GOOPTIONS} ${SRCFILES}
|
|
if [[ ! -z $DRONE_TAG ]]
|
|
then
|
|
tar -czvf ${RELEASENAME}.tar.gz ${RELEASENAME}
|
|
fi
|
|
}
|
|
|
|
clean() {
|
|
rm -rf $RELEASEDIR
|
|
}
|
|
|
|
case $1 in
|
|
"build")
|
|
build
|
|
;;
|
|
"clean")
|
|
clean
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|