Update build.sh
This commit is contained in:
28
build.sh
28
build.sh
@@ -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
|
||||
|
Reference in New Issue
Block a user