-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·39 lines (24 loc) · 779 Bytes
/
Copy pathbuild.sh
File metadata and controls
executable file
·39 lines (24 loc) · 779 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
package="up.go"
package_name="up"
if [[ -z "$package" ]]; then
echo "usage: $0 <package-name>"
exit 1
fi
platforms=("windows/amd64" "windows/386" "darwin/amd64" "linux/amd64" "linux/386" "linux/arm64" "linux/arm")
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name=$package_name'-'$GOOS'-'$GOARCH
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi
output_folder="build/"
output_total=$output_folder$output_name
echo "Building for ${GOOS} with arch ${GOARCH}"
env GOOS=$GOOS GOARCH=$GOARCH go build -o $output_total $package
echo "Completed building ${output_total}"
done
echo "All builds complete"