-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·35 lines (33 loc) · 796 Bytes
/
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
#!/bin/bash
function abort_deploy {
git stash pop;
exit 1;
}
function confirm {
while true; do
read -p "$1" yn
case $yn in
[Yy]* ) break;;
* ) abort_deploy;;
esac
done
}
echo "Check if all your changes have been commited"
echo "Master branch will be deployed to the production server"
confirm "Are you sure you want to deploy?" &&
git stash &&
git checkout production &&
git fetch &&
loc=$(git rev-parse master)
orig=$(git rev-parse origin/master)
if test "$orig" != "$loc"; then
echo "Your master branch isn't up-to-date with origin"
echo "Aborting"
abort_deploy;
fi
confirm "Are you still sure?" &&
git merge master --ff-only &&
appcfg.py update . -A the-hat -V 3 --oauth2
git push
git checkout master
git stash pop