github.com/hasnat/dolt/go@v0.0.0-20210628190320-9eb5d843fbb7/utils/publishrelease/buildbinaries.sh (about) 1 #!/bin/bash 2 3 set -e 4 set -o pipefail 5 6 script_dir=$(dirname "$0") 7 cd $script_dir/../.. 8 9 [ ! -z "$GO_BUILD_VERSION" ] || (echo "Must supply GO_BUILD_VERSION"; exit 1) 10 11 docker run --rm -v `pwd`:/src golang:"$GO_BUILD_VERSION"-buster /bin/bash -c ' 12 set -e 13 set -o pipefail 14 apt-get update && apt-get install -y zip 15 cd /src 16 BINS="dolt git-dolt git-dolt-smudge" 17 OSES="windows linux darwin" 18 ARCHS="amd64" 19 20 for os in $OSES; do 21 for arch in $ARCHS; do 22 o="out/dolt-$os-$arch" 23 mkdir -p "$o/bin" 24 cp Godeps/LICENSES "$o/" 25 for bin in $BINS; do 26 echo Building "$o/$bin" 27 obin="$bin" 28 if [ "$os" = windows ]; then 29 obin="$bin.exe" 30 fi 31 CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build -o "$o/bin/$obin" "./cmd/$bin/" 32 done 33 if [ "$os" = windows ]; then 34 (cd out && zip -r "dolt-$os-$arch" "dolt-$os-$arch") 35 else 36 tar czf "out/dolt-$os-$arch.tar.gz" -C out "dolt-$os-$arch" 37 fi 38 done 39 done 40 41 render_install_sh() { 42 local parsed=(`grep "Version = " ./cmd/dolt/dolt.go`) 43 local DOLT_VERSION=`eval echo ${parsed[2]}` 44 sed '\''s|__DOLT_VERSION__|'\''"$DOLT_VERSION"'\''|'\'' utils/publishrelease/install.sh 45 } 46 47 render_install_sh > out/install.sh 48 chmod 755 out/install.sh 49 '