Created
June 6, 2018 01:31
-
-
Save BROWNPROTON/6b38eead3080d94b333c76cffeccfe54 to your computer and use it in GitHub Desktop.
Hugo - Deployment of Project Pages From gh-pages branch
This file contains 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
#!/bin/sh | |
DIR=$(dirname "$0") | |
cd $DIR/.. | |
if [[ $(git status -s) ]] | |
then | |
echo "The working directory is dirty. Please commit any pending changes." | |
exit 1; | |
fi | |
echo "Deleting old publication" | |
rm -rf public | |
mkdir public | |
git worktree prune | |
rm -rf .git/worktrees/public/ | |
echo "Checking out gh-pages branch into public" | |
git worktree add -B gh-pages public upstream/gh-pages | |
echo "Removing existing files" | |
rm -rf public/* | |
echo "Generating site" | |
hugo | |
echo "Updating gh-pages branch" | |
cd public && git add --all && git commit -m "Publishing to gh-pages (publish.sh)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gohugo.io/hosting-and-deployment/hosting-on-github/