streaming-website/deploy.sh

39 lines
1.3 KiB
Bash
Raw Normal View History

2016-11-24 20:30:43 +00:00
#!/bin/bash
2016-10-12 07:35:01 +00:00
2016-11-15 15:59:52 +00:00
command -v find >/dev/null 2>&1 || { echo >&2 "I require find but it's not installed. Aborting."; exit 1; }
command -v xargs >/dev/null 2>&1 || { echo >&2 "I require xargs but it's not installed. Aborting."; exit 1; }
command -v php >/dev/null 2>&1 || { echo >&2 "I require php but it's not installed. Aborting."; exit 1; }
2016-10-12 07:35:01 +00:00
find . -name "*.php" -print0 | xargs -0 -n1 php -l
if [ $? -ne 0 ]; then
echo "not deploying b0rken code ;)"
exit 1
fi
2016-12-20 21:30:58 +00:00
if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $DEPLOY_BRANCH` ]; then
echo "You have commits on the master branch not pushed to origin yet. They would not be deployed."
echo "do you still which to deploy what's already in the repo? then type yes"
read -p "" input
if [ "x$input" != "xyes" ]; then
exit 2
fi
fi
2016-11-24 20:30:43 +00:00
if ! (git diff --exit-code >/dev/null || git diff --cached --exit-code >/dev/null); then
2016-12-20 21:30:58 +00:00
echo "You have uncomitted changes. They would not be deployed."
echo "do you still which to deploy what's already in the repo? then type yes"
read -p "" input
if [ "x$input" != "xyes" ]; then
exit 2
fi
fi
ssh -A voc@lb.dus.c3voc.de 'sudo sh' << EOT
2016-10-01 16:06:44 +00:00
cd /srv/nginx/streaming-website
git fetch origin
git reset --hard origin/master
chown -R voc:staff .
chown -R downloader configs
2016-10-12 07:31:23 +00:00
./clear_cache
2016-10-01 16:06:44 +00:00
EOT