-
Notifications
You must be signed in to change notification settings - Fork 5
/
local.sh
49 lines (39 loc) · 789 Bytes
/
local.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
#!/bin/bash
set -e -o pipefail
trap '[ "$?" -eq 0 ] || echo "Error Line:<$LINENO> Error Function:<${FUNCNAME}>"' EXIT
cd `dirname $0`
CURRENT=`pwd`
function test
{
set_env
go test -v $(go list ./... | grep -v vendor) --count 1 -covermode=atomic -timeout 120s
}
function release
{
sudo rm -rf $CURRENT/dist
sudo rm -rf $CURRENT/gopath
export GOPATH=$CURRENT/gopath
tag=$1
if [ -z "$tag" ]
then
echo "not found tag name"
exit 1
fi
git tag -a $tag -m "Add $tag"
git push origin $tag
goreleaser release --rm-dist
}
function release_test
{
sudo rm -rf $CURRENT/dist
sudo rm -rf $CURRENT/gopath
export GOPATH=$CURRENT/gopath
goreleaser release --snapshot --rm-dist
}
function set_env
{
source $CURRENT/local_env.sh
}
CMD=$1
shift
$CMD $*