Skip to content

Instantly share code, notes, and snippets.

@curiouslychase
Last active July 6, 2016 18:23
Show Gist options
  • Save curiouslychase/8499671 to your computer and use it in GitHub Desktop.
Save curiouslychase/8499671 to your computer and use it in GitHub Desktop.
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
Copy link

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