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