darkmist icon

publish.sh

darkmist | PRO | 12/31/16 05:40:21 PM UTC | 0 ⭐ | 207 👁️ | Never ⏰ | []
Bash |

790 B

|

None

|

0 👍

/

0 👎

#!/bin/bash
 
CUR_DATE=`date`
CWD_DIR=`pwd`
 
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
 
# Build the project.
hugo
 
# Add changes to git.
git add -A
 
# Commit changes.
msg="Updating site contents ${CUR_DATE}"
if [ $# -eq 1 ]
    then msg="${1}"
fi
git commit -m "${msg}"
 
# Push source.
git push origin master
 
# Copy new files to website directory.
cp -R public/* ~/Sandbox/donbstringham.github.io/
 
# Change to website directory.
cd ~/Sandbox/donbstringham.github.io/
 
# Add changes to git.
git add -A
 
# Commit changes.
msg="Rebuilding site ${CUR_DATE}"
if [ $# -eq 1 ]
    then msg="${1}"
fi
git commit -m "${msg}"
 
# Push source.
git push origin master
 
# Return to website source repository.
cd ${CWD_DIR}
 
echo -e "\033[0;32mAll done!\033[0m"

Comments