Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The post-receive hook that I use for deploying my Wordpress theme on a `git push`.
#!/bin/sh
LOGFILE=./post-receive.log
DEPLOYDIR=$DEPLOYDIR # The place to deploy to.
echo -e "[log] Received push request at $( date +%F)" >> $LOGFILE
echo "[log] - Old SHA: $oldrev New SHA: $newrev Branch Name: $refname" >> $LOGFILE
echo "[log] Starting Deploy..." >> $LOGFILE
echo "[log] - Starting code update"
GIT_WORK_TREE="$DEPLOYDIR" git checkout -f
echo "[log] - Finished code update"
echo "[log] - Starting npm install..."
cd "$DEPLOYDIR"; npm install; cd -
echo "[log] - Finished npm install."
echo "[log] - Starting gulp build..."
cd "$DEPLOYDIR"; gulp build; cd -
echo "[log] - Finished gulp build."
echo "[log] - Building Hugo blog..."
cd "$DEPLOYDIR" && hugo
echo "[log] - Finished building hugo blog"
echo "[log] Finished Deploy" >> $LOGFILE
@ErikSwan

This comment has been minimized.

Copy link

@ErikSwan ErikSwan commented Mar 27, 2015

What does the hugo command do in your case? I really like this approach to a simple post-receive build system but I'm a bit confused what hugo is doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment