-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·68 lines (56 loc) · 2.34 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
#######################################
## Global variables and string style ##
#######################################
bold=$(tput bold)
red="\033[0;31m"
stop_color='\033[0m'
binaryName="ipmonitor"
##########################################
## Set the execution mode of the script ##
##########################################
if [ -z $1 ]; then
VERSION="latest"
echo "Running in manual mode, version=$VERSION"
else
VERSION=$(echo $1 | sed -e 's/\./-/g')
echo "Running in release mode, version=$VERSION"
fi
###############################################
## Cross-compile ADZTBotV2 && ZIP the output ##
###############################################
mkdir "bin"
cd ./bin/
for os in linux windows darwin
do
# Linux is seperated from the other os due to the fact that it support more architechture
if [ $os == linux ]; then
echo -e "\n$red${bold}Building linux binary...${bold}$stop_color"
echo -e "$red${bold}===========================${bold}$stop_color"
for arch in amd64 386 arm64 arm
do
echo "${bold}$os/$arch...${bold}"
env GOOS=$os GOARCH=$arch go build -o $binaryName-$os-$arch-$VERSION ./../main.go
sha256sum $binaryName-$os-$arch-$VERSION > $binaryName-$os-$arch-$VERSION-sha256sum.txt
zip $binaryName-$os-$arch-$VERSION $binaryName-$os-$arch-$VERSION $binaryName-$os-$arch-$VERSION-sha256sum.txt
done
elif [ $os == darwin ]; then
echo -e "\n$red${bold}Building $os binary...${bold}$stop_color"
echo -e "$red${bold}===========================${bold}$stop_color"
arch=amd64
echo "${bold}$os/$arch...${bold}"
env GOOS=$os GOARCH=$arch go build -o $binaryName-$os-$arch-$VERSION ./../main.go
sha256sum $binaryName-$os-$arch-$VERSION > $binaryName-$os-$arch-$VERSION-sha256sum.txt
zip $binaryName-$os-$arch-$VERSION $binaryName-$os-$arch-$VERSION $binaryName-$os-$arch-$VERSION-sha256sum.txt
else
echo -e "\n$red${bold}Building $os binary...${bold}$stop_color"
echo -e "$red${bold}===========================${bold}$stop_color"
for arch in amd64 386
do
echo "${bold}$os/$arch...${bold}"
env GOOS=$os GOARCH=$arch go build -o $binaryName-$os-$arch-$VERSION ./../main.go
sha256sum $binaryName-$os-$arch-$VERSION > $binaryName-$os-$arch-$VERSION-sha256sum.txt
zip $binaryName-$os-$arch-$VERSION $binaryName-$os-$arch-$VERSION $binaryName-$os-$arch-$VERSION-sha256sum.txt
done
fi
done