update ci-build.sh
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2021-11-13 11:51:23 +01:00
parent d18c003b99
commit 70145c1504

View File

@ -11,18 +11,18 @@ SRCFILES=cmd/${PROJECTNAME}/*.go
build() { build() {
echo "Begin of build" echo "Begin of build"
if [[ ! -z $DRONE_TAG ]] if [[ ! -z ${DRONE_TAG} ]]
then then
echo "Drone tag set, let's do a release" echo "Drone tag set, let's do a release"
VERSION=$DRONE_TAG VERSION=${DRONE_TAG}
echo "${PROJECTNAME} ${VERSION}" > /build/VERSION echo "${PROJECTNAME} ${VERSION}" > /build/VERSION
elif [[ ! -z $DRONE_TAG ]] elif [[ ! -z ${DRONE_TAG} ]]
then then
echo "Drone not set, let's only do a build" echo "Drone not set, let's only do a build"
VERSION=$DRONE_COMMIT VERSION=${DRONE_COMMIT}
fi fi
if [[ ! -z $VERSION && ! -z $GOOS && ! -z $GOARCH ]] if [[ ! -z ${VERSION} && ! -z ${GOOS} && ! -z ${GOARCH} ]]
then then
echo "Let's set a release name" echo "Let's set a release name"
RELEASENAME=${PROJECTNAME}-${VERSION}-${GOOS}-${GOARCH} RELEASENAME=${PROJECTNAME}-${VERSION}-${GOOS}-${GOARCH}
@ -32,7 +32,7 @@ build() {
go generate ${SRCFILES} go generate ${SRCFILES}
go build -o ${PROJECTNAME} ${GOOPTIONS} ${SRCFILES} go build -o ${PROJECTNAME} ${GOOPTIONS} ${SRCFILES}
if [[ ! -z $DRONE_TAG ]] if [[ ! -z ${DRONE_TAG} ]]
then then
echo "Let's make archives" echo "Let's make archives"
mkdir -p /build mkdir -p /build
@ -46,10 +46,10 @@ build() {
} }
clean() { clean() {
rm -rf $RELEASEDIR rm -rf ${RELEASEDIR}
for i in ${PROJECTNAME} "cmd/${PROJECTNAME}/packrd" "cmd/${PROJECTNAME}/main-packr.go" for i in ${PROJECTNAME} "cmd/${PROJECTNAME}/packrd" "cmd/${PROJECTNAME}/main-packr.go"
do do
rm -rf $i rm -rf ${i}
done done
} }