git clone [email protected]:npatmaja/npatmaja.github.io.git public
Last active
December 26, 2015 14:56
-
-
Save npatmaja/7f30c79c08cb315466dd to your computer and use it in GitHub Desktop.
Setup Hugo deployment to Github pages without using subtree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# change into the script's directory | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
pushd $DIR > /dev/null | |
# configuration | |
OUT=out | |
TMP=tmp | |
# create temporary directory | |
mkdir $TMP | |
# copy .git/ to temp | |
cp -r $OUT/.git $TMP/.git | |
cp $OUT/.gitignore $TMP/.gitignore | |
# clean out directory and regenerate thmls | |
rm -rf $OUT | |
mkdir $OUT | |
cp -r $TMP/.git $OUT/.git | |
cp $TMP/.gitignore $OUT/.gitignore | |
# generate static htmls | |
docpad generate --env static | |
# go to the out folder | |
pushd $OUT > /dev/null | |
rm -rf posts/ | |
touch .nojekyll | |
# add and push to github pages | |
git add -A | |
git commit -m "`date`" | |
git push -f origin master | |
# change back to root dir | |
popd > /dev/null | |
# remove temp directory | |
rm -rf $TMP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment