Auto-deploying built products to gh-pages with Travis
This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.
Create a compile script
You want a script that does a local compile to e.g. an
out/ directory. Let's call this
compile.sh for our purposes, but for your project it might be
npm build or
gulp make-docs or
make or anything similar.
out/ directory should contain everything you want deployed to
gh-pages. That almost always includes an
Deploying a subfolder to GitHub Pages
Sometimes you want to have a subdirectory on the
master branch be the root directory of a repository’s
gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the
master branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named
dist directory from the project’s
.gitignore file (it’s ignored by default by Yeoman).
Creating a Happy Git Environment on OS X
brew install git bash-completion
git config --global user.name "Your Name" git config --global user.email "email@example.com"