forget-cancellare-vecchi-toot/tools/post-receive.example

35 lines
907 B
Plaintext
Raw Normal View History

2017-08-07 14:51:33 +02:00
#!/bin/sh
2017-08-07 14:56:18 +02:00
export GIT_DIR=$(git rev-parse --absolute-git-dir)
2017-08-07 14:51:33 +02:00
while read old new refname; do
branch=$(git rev-parse --abbrev-ref=strict ${refname})
if [[ $branch == "deploy" ]]; then
2017-08-07 14:56:18 +02:00
#export GIT_WORK_TREE="/tmp/forget_$RANDOM"
#mkdir -p $GIT_WORK_TREE
#git checkout deploy
cd /home/codl/forget
#(cd $GIT_WORK_TREE; git archive deploy) | tar -x
git archive deploy | tar -x
2017-08-07 14:51:33 +02:00
(
source venv/bin/activate
2017-08-19 13:21:00 +02:00
env -u GIT_DIR -u GIT_WORK_TREE pip install -r requirements.txt
2017-08-31 22:42:59 +02:00
yarn
2017-08-07 14:51:33 +02:00
FLASK_APP='forget.py' flask db upgrade
2017-08-11 14:57:32 +02:00
if [[ $(git diff --name-only ${old}..${new} dodo.py) == 'dodo.py' ]]
then
2017-08-20 20:22:53 +02:00
rm -rf static
mkdir static
2017-08-11 14:57:32 +02:00
fi
doit
2017-08-07 14:51:33 +02:00
)
systemctl --user restart forget
#rm -rf $GIT_WORK_TREE
2017-08-07 14:51:33 +02:00
fi
done