-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path,gdy
executable file
·65 lines (58 loc) · 1.11 KB
/
,gdy
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
#!/bin/bash
# Prevents running in home directory
if test $(pwd) == $HOME ; then
echo 'Do not run this script in root'
exit 1;
fi
# Checks if location is git initialized
if [ ! -e '.git' ] ; then
echo 'This is not a git repository - run git init'
exit 1;
fi
function commit {
echo 'Write commit msg, leave blank to end script'
read -r -p 'Commit message: ' message
if test "$message" == '' ; then
echo 'Cancelling deploying'
exit 0;
fi
git add .
git add -u
git commit -m "$message"
}
function staging_push {
git push
git push staging master
}
function production_push {
git push
git push production master
}
# r = skip committing, straight deploy
# s = push to staging
# h = push to heroku
# q = quick update, committ msg is just "Update"
while getopts ":spr" opt; do
case $opt in
s)
echo 'Pushing to staging initiated' >&2
commit
staging_push
;;
p)
echo "Production deploying" >&2
commit
production_push
;;
r)
echo "Pushing to just repo" >&2
commit
git push
;;
\?)
echo 'Invalid option: -$OPTARG' >&2
;;
esac
done
echo 'Deploying finished'
exit 0