forked from go-echarts/go-echarts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·46 lines (37 loc) · 821 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
#!/bin/bash
version="v2.2.3"
function pre_check() {
info=$(diff -u <(echo -n) <(format))
if [ -n "$info" ]; then
echo ">> Make sure you have formatted the codebase before committing."
echo ">> Use 'git status' command to show what have changed."
exit 1
fi
}
function format() {
go fmt ./... && ls -d */ | xargs goimports -w
}
function test() {
go test -v ./...
}
function release() {
pre_check
echo ">> Building tag..."
git tag -a $version -m "Release: $version"
echo ">> Pushing tag to the remote...."
git push origin $version
}
function help() {
echo "$0 --cmd [format|test|release]"
}
if [ "$1" == "" ]; then
help
elif [ "$1" == "format" ];then
format
elif [ "$1" == "test" ];then
test
elif [ "$1" == "release" ];then
release
else
help
fi