Update build.sh

This commit is contained in:
Carl Pearson
2017-07-26 06:24:17 -04:00
parent 8b3c28ef2b
commit 1b3d9341af

View File

@@ -1,25 +1,33 @@
#! /bin/bash
## Try to find cwpearson.github.io
HUGO_ROOT=`pwd`
paths=`find $HOME -name cwpearson.github.io`
numpaths=`echo "$paths" | wc -l`
## Try to find cwpearson.github.io
IO_ROOT=`find $HOME -name cwpearson.github.io`
echo "Found" "$IO_ROOT"
numpaths=`echo "$IO_ROOT" | wc -l`
if [[ "$numpaths" -ne "1" ]]; then
echo "Found more than one cwpearson.github.io"
exit -1
fi
# Clean up repo
cd $paths
git rm -r *
# Clean up github.io repo
cd "$IO_ROOT"
git pull
git rm -rf *
# Build website
cd -
hugo -d $paths
cd "$HUGO_ROOT"
echo "Updating submodules"
git submodule update --recursive --remote
echo "Building site"
hugo -d "$IO_ROOT"
# push new content
cd $paths
cd $IO_ROOT
git add *
git commit -m "[build.sh] Deployed from hugo-cwpearson"
git push
git push