-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.sh
executable file
·69 lines (63 loc) · 1.55 KB
/
deploy.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
. colors.bash
browser="firefox"
killall python
killall $browser
(cd site; python -m SimpleHTTPServer &)
sleep 1
echo "==========================================="
echo
echo
echo
git status
echo
check_if_committed=`git status --porcelain`
if ! [[ "$check_if_committed" = "" ]]
then
printf $red
echo "=========================================="
echo " FAILED: COMMIT FIRST BEFORE DEPLOYING "
echo "=========================================="
printf $end
exit 1
fi
branch=`git rev-parse --abbrev-ref HEAD`
if ! [[ "$branch" = "master" ]]
then
printf $red
echo "=========================================="
echo " FAILED: WRONG BRANCH "
echo "=========================================="
printf $end
exit 1
fi
echo 'pushing to master'
git push origin master:master
if [[ $? -ne 0 ]]
then
printf $red
echo "=========================================="
echo " PUSH FAILED: ABORTING DEPLOY "
echo "=========================================="
printf $end
exit 1
fi
echo 'pushed'
echo
echo 'deploying to maitria webserver'
rsync -r --progress --delete ./site/ [email protected]:/srv/maitria.com
if [[ $? -eq 0 ]]
then
printf $grn
echo "=========================================="
echo " Success! Deployed "
echo "=========================================="
printf $end
else
printf $red
echo "=========================================="
echo " DEPLOY FAILED "
echo "=========================================="
printf $end
exit 1
fi