This commit is contained in:
50
.drone.sh
50
.drone.sh
@@ -5,10 +5,46 @@
|
|||||||
# disable CGO for cross-compiling
|
# disable CGO for cross-compiling
|
||||||
export CGO_ENABLED=0
|
export CGO_ENABLED=0
|
||||||
|
|
||||||
export now=$(TZ=Australia/Sydney date '+%Y%m%d-%H%M%S')
|
#branch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
echo $now
|
commit=$(git rev-parse HEAD)
|
||||||
echo "build commences"
|
#tag=$(git describe --tags --abbrev=0)
|
||||||
go build -ldflags "-X main.sha1ver=`git rev-parse HEAD` -X main.buildTime=$now" -o api-tester .
|
buildtime=$(TZ=Australia/Sydney date +%Y-%m-%dT%T%z)
|
||||||
echo "build complete"
|
#git_version=$(git describe --tags --always --long --dirty)
|
||||||
sha256sum api-tester > api-tester_checksum.txt
|
package_name=api-tester
|
||||||
ls -lah
|
|
||||||
|
#echo "Current directory:"
|
||||||
|
#pwd
|
||||||
|
|
||||||
|
platforms=("windows/amd64" "linux/amd64" "darwin/amd64")
|
||||||
|
|
||||||
|
echo Building $package_name with git version: $git_version
|
||||||
|
for platform in "${platforms[@]}"
|
||||||
|
do
|
||||||
|
platform_split=(${platform//\// })
|
||||||
|
GOOS=${platform_split[0]}
|
||||||
|
GOARCH=${platform_split[1]}
|
||||||
|
output_name=$package_name'-'$GOOS'-'$GOARCH
|
||||||
|
if [ $GOOS = "windows" ]; then
|
||||||
|
output_name+='.exe'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "build commences"
|
||||||
|
env GOOS=$GOOS GOARCH=$GOARCH go build -trimpath -ldflags="-X main.sha1ver=$commit -X main.buildTime=$buildtime" -o build/$output_name $package
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo 'An error has occurred! Aborting the script execution...'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "build complete : $output_name"
|
||||||
|
sha256sum build/$output_name > build/${output_name}_checksum.txt
|
||||||
|
#ls -lah ./build/
|
||||||
|
done
|
||||||
|
|
||||||
|
ls -lah build
|
||||||
|
|
||||||
|
#export now=$(TZ=Australia/Sydney date '+%Y%m%d-%H%M%S')
|
||||||
|
#echo $now
|
||||||
|
#echo "build commences"
|
||||||
|
#go build -ldflags "-X main.sha1ver=`git rev-parse HEAD` -X main.buildTime=$now" -o api-tester .
|
||||||
|
#echo "build complete"
|
||||||
|
#sha256sum api-tester > api-tester_checksum.txt
|
||||||
|
#ls -lah
|
@@ -21,6 +21,6 @@ steps:
|
|||||||
api_key:
|
api_key:
|
||||||
from_secret: GITEA_TOKEN
|
from_secret: GITEA_TOKEN
|
||||||
base_url: https://git.coadcorp.com
|
base_url: https://git.coadcorp.com
|
||||||
files: api-tester
|
files: build/*
|
||||||
checksum: sha256
|
checksum: sha256
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
Reference in New Issue
Block a user