-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
71 lines (67 loc) · 1.65 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
69
70
71
#!/bin/bash
# Use git describe to set build number
BuildNumber=$(git describe --tags --dirty --always)
# Remove leading v from buildnumber if in the format v1.2.3
BuildNumber=$(sed -E "s|v([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)|\1|" <<< $BuildNumber)
if [ ! -z "$2" ]
then
BuildNumber=$2
fi
case $1 in
docker)
echo Building docker image, BuildNumber=$BuildNumber
docker build --build-arg BuildNumber=$BuildNumber -t claneventsbot:$BuildNumber -t claneventsbot:latest .
;;
win32)
echo Building ClanEventsBot32.exe, BuildNumber=$BuildNumber
GOOS=windows GOARCH=386 go build -o bin/ClanEventsBot32.exe -ldflags "-X main.buildNumber=$BuildNumber" *.go
;;
win64)
echo Building ClanEventsBot64.exe, BuildNumber=$BuildNumber
GOOS=windows GOARCH=amd64 go build -o bin/ClanEventsBot64.exe -ldflags "-X main.buildNumber=$BuildNumber" *.go
;;
linux32)
echo Building ClanEventsBot32, BuildNumber=$BuildNumber
GOOS=linux GOARCH=386 go build -o bin/ClanEventsBot32 -ldflags "-X main.buildNumber=$BuildNumber" *.go
;;
linux64)
echo Building ClanEventsBot64, BuildNumber=$BuildNumber
GOOS=linux GOARCH=amd64 go build -o bin/ClanEventsBot64 -ldflags "-X main.buildNumber=$BuildNumber" *.go
;;
all)
;;
*)
echo "Invalid OS and Architecture specified ($1)"
echo Accepted Values:
echo docker
echo win32
echo win64
echo linux32
echo linux64
echo all
exit
;;
esac
if [ $1 == 'all' ]
then
counter=1
while [ $counter -le 4 ]
do
case $counter in
1)
platform=win32
;;
2)
platform=win64
;;
3)
platform=linux32
;;
4)
platform=linux64
;;
esac
./$0 $platform $BuildNumber
((counter++))
done
fi