Created
February 26, 2018 10:56
-
-
Save megrxu/fea586de50f6ba2dcfb9b068a23fd650 to your computer and use it in GitHub Desktop.
deploy the gh-pages from a hugo site folder
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/bash | |
echo -e "\033[0;32mDeploying gh-pages to GitHub...\033[0m" | |
# Clean | |
rm -rf public | |
# Build the project. | |
hugo # if using a theme, replace with `hugo -t <YOURTHEME>` | |
# Change to gh-pages | |
cd themes/GoMDL | |
git checkout gh-pages | |
# Clean and update | |
rm -rf ./* | |
cp -r ../../public/* ./ | |
git add . | |
# Commit changes. | |
msg="rebuilding site `date`" | |
if [ $# -eq 1 ] | |
then msg="$1" | |
fi | |
git commit -m "$msg" | |
# Push source and build repos. | |
git push origin gh-pages | |
# Come Back up to the Project Root | |
git checkout master | |
cd ../.. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment