Improve post-receive

This commit is contained in:
Daniel Meiburg 2023-02-12 23:36:01 +01:00
parent 937dfbca8e
commit 25ab72e61e
Signed by: dm
GPG Key ID: E5827ECFFE0AA4F2
1 changed files with 4 additions and 5 deletions

View File

@ -8,7 +8,7 @@ WORK_TREE=~/container
# get changed folders
changed=`GIT_WORK_TREE=$WORK_TREE git diff --dirstat=files,0 HEAD | awk '{print $NF}' `
[ -n "$changed" ] && echo -e "Changed apps:\n$changed\n"
[ -n "$changed" ] && echo -e "Changed apps:\n$changed"
# update files in working direcotry
GIT_WORK_TREE=~/container git checkout -f
@ -16,15 +16,14 @@ GIT_WORK_TREE=~/container git checkout -f
# restart changed docker compose stacks
for app in $changed; do
cd $WORK_TREE/$changed
echo "Update $app"
echo -e "\nUpdate $app"
# remove old .env if no .env.gpg is supplied
[ -f .env ] && [ -f .env.gpg ] || rm .env
# decrypt .env.gpg
[ -f .env.gpg ] && gpg -d .env.gpg > .env
docker compose down
docker compose up -d
echo ""
docker compose down | uniq
docker compose up --quiet-pull -d | uniq
done
exit