mirror of
https://github.com/deuill/coreos-home-server.git
synced 2024-09-21 13:40:45 +00:00
hugo: Watch for changes with hugo watch
In addition to changes made when Git repositories update, Hugo is able to watch for timed changes to content (say, for content that has a publication date in the future) and build these automatically. This commit switches from a plain `hugo build` to a `hugo watch` process to facilitate these use-cases.
This commit is contained in:
parent
c1e326d211
commit
da043fce5e
@ -19,10 +19,14 @@ elif test ! -e "/src/${GIT_REPO}/refs/heads/${GIT_BRANCH}"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R hugo:hugo /dest
|
chown -R hugo:hugo /dest
|
||||||
|
gosu hugo git clone --quiet --shared --branch "${GIT_BRANCH}" "/src/${GIT_REPO}" /tmp/src
|
||||||
|
|
||||||
# Wait for updates to watched branch for the given site, and build static content anew.
|
# Wait for updates to watched branch for the given site, and build static content anew.
|
||||||
while true; do
|
(
|
||||||
gosu hugo git clone --quiet --shared --branch "${GIT_BRANCH}" "/src/${GIT_REPO}" /tmp/src
|
cd /tmp/src
|
||||||
gosu hugo hugo --verbose --source /tmp/src --destination /dest && rm -Rf /tmp/src
|
while inotifywait -qq --event modify "/src/${GIT_REPO}/refs/heads/${GIT_BRANCH}"; do
|
||||||
inotifywait -qq --event modify "/src/${GIT_REPO}/refs/heads/${GIT_BRANCH}" && break
|
gosu hugo git fetch origin "${GIT_BRANCH}" && gosu hugo git reset --hard "${GIT_BRANCH}"
|
||||||
done
|
done
|
||||||
|
) &
|
||||||
|
|
||||||
|
gosu hugo hugo watch --verbose --source /tmp/src --destination /dest
|
||||||
|
Loading…
Reference in New Issue
Block a user