From 464be8444ab875a5c4e1e5593dc6ba4a8b28e541 Mon Sep 17 00:00:00 2001 From: Ava Howell Date: Tue, 14 Nov 2017 13:34:11 -0500 Subject: [PATCH] add release.sh --- release.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 release.sh diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..5c423a0 --- /dev/null +++ b/release.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +set -e + +name="$1" +if [[ -z $name ]]; then + echo "Usage: $0 name version" + exit 1 +fi + +version="$2" +if [[ -z $version ]]; then + echo "Usage: $0 name version" + exit 1 +fi + +for os in darwin linux windows; do + folder=release/$name-$version-$os-amd64 + rm -rf $folder + mkdir -p $folder + bin="$name" + if [ "$os" == "windows" ]; then + bin="${name}.exe" + fi + echo "building ${os}..." + + GOOS=${os} GOARCH=amd64 go build -a -tags 'netgo' -o $folder/$bin . + cp LICENSE README.md $folder + + ( + cd release + zip -rq $name-$version-$os-amd64.zip $name-$version-$os-amd64 + ) + if [ $os = "linux" ] + then + folder=release/$name-$version-$os-arm64 + rm -rf $folder + mkdir -p $folder + GOOS=${os} GOARCH=arm64 go build -a -tags 'netgo' -o $folder/$bin . + cp LICENSE README.md $folder + + ( + cd release + zip -rq $name-$version-$os-arm64.zip $name-$version-$os-arm64 + ) + fi +done + +echo "done" +