-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.sh
executable file
·46 lines (38 loc) · 1.01 KB
/
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
#!/bin/sh
OSs="darwin linux freebsd windows"
ARCHs="arm64 amd64"
if [ -z $1 ]; then
echo "error: requires argument of [release|freebsd|darwin|linux|windows]"
exit 1
fi
OS=$1
if [ -z $2 ]; then
echo "error: requires argument of <bin name>"
exit 1
fi
BINARY=$2
if [ -z $3 ]; then
echo "error: requires argument of <semver>"
exit 1
fi
VERSION=$3
if [ -z $4 ]; then
echo "error: requires argument of <git sha>"
exit 1
fi
GIT_SHA=$4
if [ ${OS} == "release" ]; then
echo "Generating ${BINARY} release binaries..."
for os in ${OSs}; do
for arch in ${ARCHs}; do
if [ ${arch} = "arm64" ] && [ ${os} = "windows" ]; then
continue
fi
if [ ${arch} = "arm64" ] && [ ${os} = "darwin" ]; then
continue
fi
GOOS=${os} GOARCH=${arch} go build -v -ldflags "-X main.gitSHA=${GIT_SHA} -X main.version=${VERSION} -X main.name=${BINARY}" -o bin/${BINARY}-${os}-${arch}
done
done
fi
exit 0