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

35 lines
774 B
Plaintext
Raw Permalink Normal View History

2017-08-07 14:51:33 +02:00
#!/bin/sh
2017-08-07 14:56:18 +02:00
2017-08-07 14:51:33 +02:00
while read old new refname; do
2018-02-03 17:47:22 +01:00
export GIT_DIR=$(git rev-parse --absolute-git-dir)
2017-08-07 14:51:33 +02:00
branch=$(git rev-parse --abbrev-ref=strict ${refname})
2018-02-03 17:47:22 +01:00
2017-08-07 14:51:33 +02:00
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:47:22 +01:00
export GIT_DIR="$PWD/.git"
git checkout deploy
git fetch --prune origin
git reset --hard origin/deploy
2017-08-07 14:51:33 +02:00
(
source venv/bin/activate
2018-02-03 17:47:22 +01:00
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