Last active
May 9, 2017 16:16
-
-
Save aramk/5659983 to your computer and use it in GitHub Desktop.
Publishing Jekyll to gh-pages branch
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 | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
cd $DIR | |
SELF=`basename $0` | |
SOURCE_BRANCH="master" | |
DEST_BRANCH="gh-pages" | |
TMP_DIR="tmp" | |
git checkout $SOURCE_BRANCH | |
jekyll build -d $TMP_DIR | |
git checkout $DEST_BRANCH | |
# This will remove previous files, which we may not want (e.g. CNAME) | |
# git rm -qr . | |
cp -r $TMP_DIR/. . | |
# Delete this script from the output | |
rm ./$SELF | |
rm -r $TMP_DIR | |
git add -A | |
git commit -m "Published updates" | |
# May not want to push straight away | |
# git push origin master | |
git checkout $SOURCE_BRANCH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great script!