POST-Deploying multiple jekyll sites at once

This commit is contained in:
2018-12-06 00:54:12 -05:00
parent f3e3ff8ee8
commit 9054920687
2 changed files with 97 additions and 8 deletions

View File

@@ -5,28 +5,24 @@
GIT_REPO="$(pwd)"
TMP_GIT_CLONE="/tmp/${GIT_REPO##*/}"
if [ ! -d "{$TMP_GIT_CLONE}" ]; then
git clone "${GIT_REPO}" "$TMP_GIT_CLONE"
if [ ! -d "${TMP_GIT_CLONE}" ]; then
git clone "${GIT_REPO}" "${TMP_GIT_CLONE}"
cd "${TMP_GIT_CLONE}"
else
cd "${TMP_GIT_CLONE}"
# avoid breaking the build when force pushing
git fetch --all
git reset --hard origin/master
git pull
fi
pushd "${TMP_GIT_CLONE}"
for site in *.*/; do
[[ ! -d /var/www/${site} ]] && mkdir -p /var/www/${site} && chgrp -R /var/www/${site} && chmod g+s /var/www/${site}
[ ! -d /var/www/${site} ] && mkdir -p /var/www/${site} && chgrp -R /var/www/${site} && chmod g+s /var/www/${site}
pushd ${site}
bundle install --deployment
bundle exec jekyll build --destination /var/www/${site}
popd
done
exit
exit 0