Skip to content

Instantly share code, notes, and snippets.

@dueyfinster
Last active November 7, 2016 14:40
Show Gist options
  • Select an option

  • Save dueyfinster/67c306c83687fd6c21e92ed837839730 to your computer and use it in GitHub Desktop.

Select an option

Save dueyfinster/67c306c83687fd6c21e92ed837839730 to your computer and use it in GitHub Desktop.
Builds hugo static website on NearlyFreeSpeech.NET
#!/bin/bash
# A Script to do a hugo build if any future posts exist
#set -x
cd $HOME/repos/ngrogan.com
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse origin)
if [ $LOCAL = $REMOTE ]; then
:
else
git pull
fi
grep -o "[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}" -R content | grep -o "[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}" | sed -e 's/\-//g' | ( while read line; do
cond=$(date +"%Y%m%d") # = 20130715
if [ $line -ge $cond ]; #put the loop where you need it
then
NEEDS_UPDATE=true
fi
done
if [ "$NEEDS_UPDATE" = true ]; then
~/bin/hugo -d $DOCUMENT_ROOT
fi )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment