Skip to content

Instantly share code, notes, and snippets.

@hemc4
Created August 30, 2020 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hemc4/56e2ec2b69301652241b080dfa150ed9 to your computer and use it in GitHub Desktop.
Save hemc4/56e2ec2b69301652241b080dfa150ed9 to your computer and use it in GitHub Desktop.
Hugo github pages deploy
#!/bin/sh
# If a command fails then the deploy stops
set -e
printf "\033[0;32mDeploying updates to GitHub...\033[0m\n"
# Build the project.
hugo -t mem # if using a theme, replace with `hugo -t <YOURTHEME>`
# Go To Public folder
cd public
# Add changes to git.
git add .
# Commit changes.
msg="rebuilding site $(date)"
if [ -n "$*" ]; then
msg="$*"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
## hem changes
cd ..
git add .
git commit -m "$msg"
# Push source and build repos.
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment