c3space-website2.0/deploy.sh

38 lines
655 B
Bash
Raw Normal View History

2019-12-20 14:01:00 +01:00
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 <destionation>"
exit -1
fi
DEST="$1"
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd $DIR
echo "Repo directory is $DIR"
git checkout master
2019-12-20 14:01:00 +01:00
git pull
git rev-parse HEAD > .tmp_id
if [ -d output ] && [ -f .head_id ] && diff -q .head_id .tmp_id; then
rm .tmp_id
echo "No changes since last run"
exit 0
fi
if [ ! -d ./virtenv ]; then
2019-12-20 15:34:08 +01:00
python3.8 -m venv virtenv
2019-12-20 14:01:00 +01:00
fi
source virtenv/bin/activate
2019-12-20 15:34:08 +01:00
pip install --upgrade pip || exit -1
pip install -r requirements.txt || exit -1
2019-12-20 14:01:00 +01:00
rm -rf output
2019-12-20 15:34:08 +01:00
nikola build || exit -1
2019-12-20 14:01:00 +01:00
2019-12-20 15:53:55 +01:00
rsync -Pvrt --delete ./output/ $DEST
2019-12-20 14:01:00 +01:00
mv .tmp_id .head_id