-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·33 lines (27 loc) · 1012 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
#!/bin/bash
set -e
nowDate=$(date +"%Y-%m-%d")
nowTime=$(date +"%H-%M-%S")
commitHash=$(git rev-parse --short HEAD)
versionString="$nowDate.$nowTime.0.$commitHash"
echo $versionString
versionOld=$(grep "const LomoWebVersion" main.go)
echo "old verion: $versionOld"
sed -i.bak -E "s/[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}\.[[:digit:]]{2}-[[:digit:]]{2}-[[:digit:]]{2}\.0\.[a-zA-Z0-9]{7}/$versionString/g" main.go
versionNew=$(grep "const LomoWebVersion" main.go)
echo "new verion: $versionNew"
rice embed-go
if [ "$(uname)" == "Darwin" ]; then
CGO_CFLAGS=-mmacosx-version-min=10.10 CGO_LDFLAGS=-mmacosx-version-min=10.10 go build -o lomo-web
zip -r lomoWebOSX.zip lomo-web
shasum -a256 lomoWebOSX.zip
elif [ "$(uname)" == "Linux" ]; then
go build -o lomo-web
./pack.sh $versionString
elif [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]; then
go build -o lomo-web
zip -r lomoWebWin.zip lomo-web
certUtil -hashfile lomoWebWin.zip SHA256
else
go build -o lomo-web
fi