Skip to content

Instantly share code, notes, and snippets.

@npatmaja npatmaja/deploy
Last active Dec 26, 2015

Embed
What would you like to do?
Setup Hugo deployment to Github pages without using subtree
#!/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

Assuming Hugo's output directory is public/

git clone git@github.com:npatmaja/npatmaja.github.io.git public

then do the deployment script below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.