-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·39 lines (29 loc) · 1.02 KB
/
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
34
35
36
37
38
39
#!/bin/sh
# wrapper script to pull the latest site content and redeploy
cd $(dirname $0)
export PATH=$PATH:$HOME/.poetry/bin
# see where in the history we are now
PREV=$(git rev-parse --short HEAD)
git pull --ff-only || exit 1
disposition=reload
if git diff --name-only $PREV | grep -qE '^(templates/|app\.py|users\.cfg)' ; then
echo "Configuration or template change detected"
disposition=reload-or-restart
fi
if git diff --name-only $PREV | grep -q poetry.lock ; then
echo "poetry.lock changed"
poetry install || exit 1
disposition=restart
fi
if [ "$1" != "nokill" ] && [ ! -z "$disposition" ] ; then
systemctl --user $disposition publ.beesbuzz.biz.service
fi
echo "Updating the content index..."
poetry run flask publ reindex
count=0
while [ $count -lt 5 ] && [ ! -S $HOME/.vhosts/publ.beesbuzz.biz ] ; do
count=$(($count + 1))
echo "Waiting for service to restart... ($count)"
sleep $count
done
poetry run pushl -rvvc $HOME/var/pushl http://publ.beesbuzz.biz/feed https://publ.beesbuzz.biz/feed