Skip to content

Instantly share code, notes, and snippets.

@matsest
Created November 21, 2018 21:38
Show Gist options
  • Select an option

  • Save matsest/259f164793d84deae18050b7e2855330 to your computer and use it in GitHub Desktop.

Select an option

Save matsest/259f164793d84deae18050b7e2855330 to your computer and use it in GitHub Desktop.
A simple build and deploy script too publish my site https://github.com/matsest/matsest.github.io
#!/bin/bash
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
echo -e "\033[0;32mRemoving old files...\033[0m"
rm -r public/*
# Build the project.
echo -e "\033[0;32mBuilding new site...\033[0m"
hugo --minify
# Go To Public folder
echo -e "\033[0;32mChanging dir to public...\033[0m"
cd public
# Add changes to git
echo -e "\033[0;32mAdding changes...\033[0m"
git add .
# Commit changes
msg="rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "$msg"
echo -e "\033[0;32mCommiting changes...\033[0m"
# Push source to remote
git push origin master
# Come Back up to the Project Root
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment