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

34 lines
819 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
2018-02-03 17:05:19 +01:00
cd "$HOME/forget"
2018-02-03 17:05:19 +01:00
(
unset GIT_DIR
unset GIT_WORK_TREE
git checkout deploy
git reset --hard upstream/deploy
)
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
2017-08-07 14:51:33 +02:00
fi
done