-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
48 lines (41 loc) · 1011 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
#!/usr/bin/env bash
# check page
if [ ! -d "./page/dist/" ]; then
echo "Build page..."
cd page
yarn run build
cd ../
fi
echo "Start packaging..."
go mod download
go mod tidy
mkdir ./out
cp LICENSE ./out/LICENSE
generate(){
CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -o quest -ldflags '-s -w'
mv quest ./out/quest-$2-$1
cd out
tar -zcf quest-$2-$1.tar.gz quest-$2-$1 LICENSE
rm -rf ./quest-$2-$1
cd ../
}
generate_exe(){
CGO_ENABLED=0 GOOS=windows GOARCH=$1 go build -o quest -ldflags '-s -w'
mv quest ./out/quest-$1-windows.exe
cd out
zip -q quest-$1-windows.zip quest-$1-windows.exe LICENSE
rm -rf ./quest-$1-windows.exe
cd ../
}
echo "[1] MacOS from amd64"
generate darwin amd64
# echo "[2] MacOS from arm64"
# generate darwin arm64
echo "[3] Linux from amd64"
generate linux amd64
# echo "[4] Linux from arm64"
# generate linux arm64
# echo "[5] Windows from amd64"
# generate_exe amd64
# echo "[6] Windows from arm64"
# generate_exe arm64