|
|
@ -23,15 +23,12 @@ _init() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# List of supported architectures |
|
|
|
# List of supported architectures |
|
|
|
SUPPORTED_OSARCH='linux/386 linux/amd64 linux/arm windows/386 windows/amd64 darwin/amd64' |
|
|
|
SUPPORTED_OSARCH='linux/386 linux/amd64 linux/arm windows/386 windows/amd64 darwin/amd64 freebsd/amd64' |
|
|
|
|
|
|
|
|
|
|
|
## System binaries |
|
|
|
## System binaries |
|
|
|
CP=`which cp` |
|
|
|
CP=`which cp` |
|
|
|
SHASUM=`which shasum` |
|
|
|
SHASUM=`which shasum` |
|
|
|
GZIP=`which gzip` |
|
|
|
|
|
|
|
ZIP=`which zip` |
|
|
|
|
|
|
|
SED=`which sed` |
|
|
|
SED=`which sed` |
|
|
|
TAR=`which tar` |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
go_build() { |
|
|
|
go_build() { |
|
|
@ -48,9 +45,6 @@ go_build() { |
|
|
|
release_real_bin="$release_str/$os-$arch/$(basename $package)" |
|
|
|
release_real_bin="$release_str/$os-$arch/$(basename $package)" |
|
|
|
# Release shasum name |
|
|
|
# Release shasum name |
|
|
|
release_shasum="$release_str/$os-$arch/$(basename $package).shasum" |
|
|
|
release_shasum="$release_str/$os-$arch/$(basename $package).shasum" |
|
|
|
# Release zip file. |
|
|
|
|
|
|
|
release_real_zip="$(basename $package).zip" |
|
|
|
|
|
|
|
release_real_tgz="$(basename $package).tgz" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Go build to build the binary. |
|
|
|
# Go build to build the binary. |
|
|
|
GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin |
|
|
|
GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin |
|
|
@ -65,24 +59,6 @@ go_build() { |
|
|
|
# Calculate shasum |
|
|
|
# Calculate shasum |
|
|
|
shasum_str=$(${SHASUM} ${release_bin}) |
|
|
|
shasum_str=$(${SHASUM} ${release_bin}) |
|
|
|
echo ${shasum_str} | $SED "s/$release_str\/$os-$arch\///g" > $release_shasum |
|
|
|
echo ${shasum_str} | $SED "s/$release_str\/$os-$arch\///g" > $release_shasum |
|
|
|
|
|
|
|
|
|
|
|
# Create a compressed file. |
|
|
|
|
|
|
|
if [ $os == "windows" ]; then |
|
|
|
|
|
|
|
cd "$release_str/$os-$arch" |
|
|
|
|
|
|
|
$ZIP -r $release_real_zip $(basename $package).exe |
|
|
|
|
|
|
|
cd - |
|
|
|
|
|
|
|
elif [ $os == "darwin" ]; then |
|
|
|
|
|
|
|
cd "$release_str/$os-$arch" |
|
|
|
|
|
|
|
$ZIP -r $release_real_zip $(basename $package) |
|
|
|
|
|
|
|
cd - |
|
|
|
|
|
|
|
elif [ $os == "linux" ]; then |
|
|
|
|
|
|
|
cd "$release_str/$os-$arch" |
|
|
|
|
|
|
|
$TAR -czf $release_real_tgz $(basename $package) |
|
|
|
|
|
|
|
cd - |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
echo "$os operating system is not supported." |
|
|
|
|
|
|
|
exit 1 |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
main() { |
|
|
|
main() { |
|
|
|