4
0
zricethezav 8 жил өмнө
parent
commit
c51944c4d2
1 өөрчлөгдсөн 21 нэмэгдсэн , 0 устгасан
  1. 21 0
      build.sh

+ 21 - 0
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
+