forked from opentdp/wrest-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
53 lines (35 loc) · 1.42 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
#!/bin/sh
#
set -e
set -o noglob
###########################################
export CGO_ENABLED=0
export GO111MODULE=on
export GOOS=windows
export GOARCH=386
####################################################################
RUN_NUMBER=${GITHUB_RUN_NUMBER:-0}
last_tag=`git tag | sort -V | tail -n 1`
prev_tag=`git tag | sort -V | tail -n 2 | head -n 1`
git log $prev_tag..$last_tag --pretty=format:"%s" | grep -v "^release" | sed 's/^/- /' | sort > RELEASE.md
version=`echo $last_tag | sed 's/^v//'`
sed -i "s/^const Version = \".*\"/const Version = \"$version\"/" args/build.go
build_version=$((`grep -oP 'BuildVersion = "\K\d+' args/build.go` + $RUN_NUMBER))
sed -i "s/^const BuildVersion = \".*\"/const BuildVersion = \"$build_version\"/" args/build.go
echo "build info - tag: $last_tag, version: $version, build: $build_version"
####################################################################
if [ -f webview/public/browser/index.html ]; then
ls -al webview
ls -al webview/public
ls -al webview/public/browser
cp -av webview/public/browser/. public/
fi
echo building for $GOOS/$GOARCH
target=build/wrest.exe
go build -ldflags="-s -w" -o $target main.go
####################################################################
cp README.md build/
cp config.yml build/
sed -i 's#](./#](https://github.com/opentdp/wechat-rest/blob/master/#g' build/README.md
mv build wechat-rest
zip -r wechat-rest.zip wechat-rest/