qrz/ci-build.sh

21 lines
413 B
Bash
Raw Normal View History

2020-04-07 23:43:41 +02:00
#!/bin/bash
2020-04-08 00:13:49 +02:00
VERSION=""
if [[ ! -z $DRONE_TAG ]]
2020-04-08 00:14:19 +02:00
then
2020-04-08 00:13:49 +02:00
VERSION=$DRONE_TAG
2020-04-08 00:19:43 +02:00
else
2020-04-08 00:13:49 +02:00
VERSION=$DRONE_COMMIT
2020-04-08 00:15:20 +02:00
fi
2020-04-07 23:47:40 +02:00
2020-04-08 00:19:43 +02:00
if [[ ! -z $VERSION && ! -z $GOOS && ! -z $GOARCH ]]
2020-04-07 23:43:41 +02:00
then
mkdir dist
2020-04-08 00:19:43 +02:00
go build -o dist/qrz-${VERSION}-${GOOS}-${GOARCH} -mod=vendor -ldflags='-s -w' cmd/qrz/*.go
2020-04-07 23:43:41 +02:00
cd dist
2020-04-08 00:19:43 +02:00
tar -czvf qrz-${VERSION}-${GOOS}-${GOARCH}.tar.gz qrz-${VERSION}-${GOOS}-${GOARCH}
2020-04-07 23:43:41 +02:00
else
echo "Required variables not set"
fi