-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease_script.sh
More file actions
32 lines (22 loc) · 1.17 KB
/
Copy pathrelease_script.sh
File metadata and controls
32 lines (22 loc) · 1.17 KB
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
VERSION=$1 #The first argument should be the version script
#=====================PRINTING THE BUILD SETTINGS=====================
echo "[INFO] Build setting(VERSION):" $VERSION
#=====================BUILDING(STATIC LINKING)=====================
echo "[INFO] building..."
# GNU/Linux build
CGO_ENABLED=1 CC=gcc GOOS=linux GOARCH=amd64 go build -tags static -ldflags "-s -w" -v -o ./release/tanks-$VERSION-GNU-Linux-amd64
# Windows build
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -tags static -ldflags "-s -w" -v -o ./release/tanks-$VERSION-windows-amd64.exe
#=====================ADDING RESOURCES, AND COMPRESSING INTO AN ARCHIEVE=====================
echo "[INFO] copying resources and creating archieve..."
cp -r resources ./release
echo "[INFO] Entering release dir, and creating archieve..."
cd ./release
zip -r tanks-$VERSION-GNU-Linux-amd64.zip resources tanks-$VERSION-GNU-Linux-amd64
zip -r tanks-$VERSION-windows-amd64.zip resources tanks-$VERSION-windows-amd64.exe
#=====================CLEANUP=====================
echo "[INFO] cleanup..."
rm -r resources
rm tanks-$VERSION-GNU-Linux-amd64
rm tanks-$VERSION-windows-amd64.exe
echo "[INFO] done"