Update post-receive hook script
This commit is contained in:
@@ -4,11 +4,11 @@
|
|||||||
GIT_DIR="$(pwd)"
|
GIT_DIR="$(pwd)"
|
||||||
TMP_GIT_DIR="/tmp/${GIT_DIR##*/}"
|
TMP_GIT_DIR="/tmp/${GIT_DIR##*/}"
|
||||||
|
|
||||||
if [ ! -d "${TMP_GIT_DIR}" ]; then
|
if [[ ! -d "${TMP_GIT_DIR}" ]]; then
|
||||||
git clone "${GIT_DIR}" "${TMP_GIT_DIR}"
|
git clone "${GIT_DIR}" "${TMP_GIT_DIR}"
|
||||||
cd "${TMP_GIT_DIR}"
|
cd "${TMP_GIT_DIR}" || exit $?
|
||||||
else
|
else
|
||||||
cd "${TMP_GIT_DIR}"
|
cd "${TMP_GIT_DIR}" || exit $?
|
||||||
unset GIT_DIR
|
unset GIT_DIR
|
||||||
git fetch --all
|
git fetch --all
|
||||||
git reset --hard origin/master
|
git reset --hard origin/master
|
||||||
@@ -16,12 +16,16 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for site in *.*/; do
|
for site in *.*/; do
|
||||||
[ ! -d /var/www/${site} ] && mkdir -p /var/www/${site} && chgrp -R /var/www/${site} && chmod g+s /var/www/${site}
|
deploy_dir="/var/www/${site}"
|
||||||
pushd ${site}
|
if [[ ! -d "$deploy_dir" ]]; then
|
||||||
bundle install --deployment
|
mkdir -p "$deploy_dir"
|
||||||
bundle exec jekyll build --destination /var/www/${site}
|
chgrp -R "$deploy_dir"
|
||||||
popd
|
chmod g+s "$deploy_dir"
|
||||||
|
fi
|
||||||
|
pushd "${site}" || exit $?
|
||||||
|
bundle install --deployment
|
||||||
|
bundle exec jekyll build --destination "$deploy_dir"
|
||||||
|
popd || exit $?
|
||||||
done
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
exit
|
|
||||||
|
|||||||
Reference in New Issue
Block a user