self-updating post-receive. this is an awful idea

main
Jonathan Dahan 12 months ago
parent 4af558d4ce
commit 947b7f234e

@ -3,25 +3,28 @@ set -e -u -o pipefail
while read oldrev newrev ref
do
if [[ $ref =~ .*/main$ ]];
then
echo "main ref received"
if [[ $ref =~ .*/main$ ]]; then
echo "main ref received"
echo "moving into temporary work tree"; {
gitdir=$PWD
cd $(mktemp -d)
}
gitdir=$PWD
cd $(mktemp -d)
}
echo "checking out latest source"; {
git --work-tree=$PWD --git-dir=$gitdir checkout --force
}
echo "checking out latest source"; {
git --work-tree=$PWD --git-dir=$gitdir checkout --force
}
echo "generating static site"; {
podman-compose build
}
echo "generating static site"; {
podman-compose build
}
echo "restarting server"; {
podman-compose restart || podman compose up
}
fi
echo "restarting server"; {
podman-compose restart || podman compose up
}
echo "updating post-receive hook for future runs"; {
cp hooks/post-receive $0
}
fi
done

Loading…
Cancel
Save