From c51944c4d2b4f6ffb5b77c901866bfe0f4aa9f46 Mon Sep 17 00:00:00 2001 From: zricethezav Date: Mon, 12 Mar 2018 17:58:07 -0500 Subject: [PATCH] build script --- build.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..3df96466 --- /dev/null +++ b/build.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +platforms=("windows/amd64" "windows/386" "darwin/amd64") + +for platform in "${platforms[@]}" +do + platform_split=(${platform//\// }) + GOOS=${platform_split[0]} + GOARCH=${platform_split[1]} + output_name=gitleaks'-'$GOOS'-'$GOARCH + if [ $GOOS = "windows" ]; then + output_name+='.exe' + fi + + env GOOS=$GOOS GOARCH=$GOARCH go build -o $output_name $package + if [ $? -ne 0 ]; then + echo 'An error has occurred! Aborting the script execution...' + exit 1 + fi +done +