-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
51 lines (45 loc) · 861 Bytes
/
build.sh
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
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
trap "exit" ERR
OS=$1
build_darwin () {
GOOS=darwin
GOARCH=amd64
name=bigboy-${GOOS}-${GOARCH}
GOOS=$GOOS GOARCH=$GOARCH go build -o bin/$name
tar -czvf bin/$name.tar.gz bin/$name
}
build_linux () {
GOOS=linux
GOARCH=amd64
name=bigboy-${GOOS}-${GOARCH}
GOOS=$GOOS GOARCH=$GOARCH go build -o bin/$name
tar -czvf bin/$name.tar.gz bin/$name
}
build_windows() {
GOOS=windows
GOARCH=amd64
name=bigboy-${GOOS}-${GOARCH}
GOOS=$GOOS GOARCH=$GOARCH go build -o bin/$name.exe
zip bin/$name bin/$name.exe
}
if [[ -z $OS ]]; then
build_darwin
build_linux
build_windows
else
case $OS in
darwin)
build_darwin
;;
linux)
build_linux
;;
windows)
build_windows
;;
*)
echo 'Invalid OS name. Has to be one of darwin|linux|windows'
exit 1
;;
esac
fi