-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy.sh
executable file
·33 lines (33 loc) · 1017 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
#!/usr/bin/env bash
branch="$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')"
if [ "$branch" = "master" ]; then
read -r -p "Deploy to production? " input
case "$input" in
[yY][eE][sS]|[yY])
if yarn build; then
rsync -ae ssh --progress --delete --chmod=u+rw,g+rw,o+r --exclude-from 'exclude-list.txt' ./ morsecodemedia:/var/www/www.morsecodemedia.com/
ssh morsecodemedia "pm2 restart 'morsecodemedia prod'"
else
echo "Failed to build site. Aborting"
fi
;;
*)
exit 0
;;
esac
else
read -r -p "Deploy to stage? " input
case "$input" in
[yY][eE][sS]|[yY])
if yarn build; then
rsync -ae ssh --progress --delete --chmod=u+rw,g+rw,o+r --exclude-from 'exclude-list.txt' ./ morsecodemedia:/var/www/stage.morsecodemedia.com/
ssh morsecodemedia "pm2 restart 'morsecodemedia stage'"
else
echo "Failed to build site. Aborting"
fi
;;
*)
exit 0
;;
esac
fi