-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·24 lines (21 loc) · 733 Bytes
/
build.sh
File metadata and controls
executable file
·24 lines (21 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
package_name="areyouok"
platforms=("windows/amd64" "linux/amd64" "linux/arm64" "linux/386" "darwin/amd64")
# remove any old binaries
echo -e "Removing previous builds"
rm "$package_name"-*
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
printf "%s " "Building for $GOOS-$GOARCH"
if export GOOS="$GOOS" GOARCH="$GOARCH"; then
output_name="$package_name-$GOOS-$GOARCH$(go env GOEXE)"
go build -ldflags="-X 'main.aroVersion=$1' -X 'main.aroDate=$(date '+(%d %b %Y)')'" -o "$output_name"
echo -e "✅"
else
echo -e "An error has occurred! Aborting ..."
exit 1
fi
done