-
Notifications
You must be signed in to change notification settings - Fork 3
/
pullpush.sh
executable file
·45 lines (34 loc) · 997 Bytes
/
pullpush.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
#!/usr/bin/env bash
set -e # exit on error
if [ $# -eq 0 ] ; then
echo "Usage:
./pullpush.sh 'the commit message'"
exit
fi
# format indentation
goimports -w **/*.go
echo "codes formatted.."
# update deps
go get -u -v github.com/kokizzu/gotro@latest
go mod tidy
# testing if has "gokil" included
ag gokil **/*.go && ( echo 'echo should not import previous gokil library..' ; kill 0 )
echo "imports checked.."
# test with race
go test -race .
# add and commit all files
git add .
git status
read -p "Press Ctrl+C to exit, press any enter key to check the diff..
"
# recheck again
git diff --staged
echo 'Going to commit with message: '\"$*\"
read -p "Press Ctrl+C to exit, press any enter key to really commit..
"
git commit -m "$*" && git pull && git push origin master
git tag -a `ruby -e 't = Time.now; print "v1.#{t.month+(t.year-2021)*12}%02d.#{t.hour}%02d" % [t.day, t.min]'` -m "$*"
git push --tags
# delete tag:
# git tag -d v1.mdd.hhmm
# git push -d origin v1.mdd.hhmm