39 lines
579 B
Plaintext
39 lines
579 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
set -e
|
||
|
|
||
|
REPO="https://git.c3re.de/c3re/test-website.git"
|
||
|
|
||
|
refresh() {
|
||
|
cd
|
||
|
|
||
|
test -d site/.git || {
|
||
|
test -d site && rm -rf site
|
||
|
git clone --recursive "$REPO" site
|
||
|
|
||
|
}
|
||
|
|
||
|
cd site
|
||
|
git pull
|
||
|
# iterate over all branches and checkout that branch
|
||
|
for branch in $(git branch -a | grep remotes | grep -v HEAD); do
|
||
|
branch=${branch#remotes/origin/}
|
||
|
git checkout "$branch"
|
||
|
git pull
|
||
|
git reset --hard
|
||
|
hugo
|
||
|
mkdir -p /var/www/html/"$branch"
|
||
|
rsync -avz --delete public/* /var/www/html/"$branch"/
|
||
|
|
||
|
done
|
||
|
|
||
|
}
|
||
|
|
||
|
while true; do
|
||
|
sleep 60 &
|
||
|
|
||
|
refresh
|
||
|
|
||
|
wait
|
||
|
|
||
|
done
|