Created
January 11, 2016 16:05
-
-
Save erickzanardo/02d39aef78999ed5cc0c to your computer and use it in GitHub Desktop.
Simple bash script to "deploy" some static project to github pages
This file contains hidden or 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 | |
FOLDER=$1 | |
REMOTE=$2 | |
if [ "$2" = "" ] | |
then | |
REMOTE="origin" | |
fi | |
REMOTEURL="remote.$REMOTE.url" | |
REMOTEURL=`git config --get $REMOTEURL` | |
mkdir /tmp/ghpp | |
echo "#######################" | |
echo "# Clonning repository #" | |
echo "#######################" | |
echo "" | |
git clone -b gh-pages --single-branch $REMOTEURL /tmp/ghpp | |
echo "######################" | |
echo "# Cleaning old files #" | |
echo "######################" | |
echo "" | |
rm -rf /tmp/ghpp/* | |
echo "#####################" | |
echo "# Copying new files #" | |
echo "#####################" | |
echo "" | |
cp -r $FOLDER/* /tmp/ghpp/ | |
cd /tmp/ghpp | |
git add . -A | |
git commit -am"Updating static files" | |
git push $REMOTE gh-pages | |
rm -rf /tmp/ghpp | |
echo "########" | |
echo "# DONE #" | |
echo "########" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment