Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 2.23 KB

README.md

File metadata and controls

53 lines (41 loc) · 2.23 KB

Push to gh-pages

If you want to push a static web site to the gh-pages branch on github and you want to automate it, then this tool might be something you are looking for.

This tool takes a configured directory and updates a cloned github repo's gh-pages branch with it and pushes the changes back with a commit message such as Travis deployed "master" - Wed Feb 25 13:06:00 UTC 2015.

This way you can focus on development and less on continuously building and pushing it to gh-pages branch, which in the end is nothing you want to waste your time on, it should just happen when you pushed into master, right? Continuous Deployment #ftw.

Motivation?

I had a couple of sites 1, 2 and 3 that were served by github-pages which means they were static pages and the files that are finally served are pushed into the branch gh-pages and github automatically takes care of publishing them on the default or a custom URL. A pretty cool github feature!
The default way to do that for generated content, sites that are generated from templates or alike is normally jekyll. Jekyll is Ruby tool which does it's job very nicely and is very wide-spread. I tried it a couple of times and didn't really fall in love. But due to my django background I always fell for swig and since I used that for 1 and was pretty happy with it I only missed the last step: building and pushing the resulting static files into the branch gh-pages. For quite a while I did that always locally, which resulted in commits with the message Built. Useless and actually not contributing to the actual underlying reason why the code is there, but a by-product of deployment.
That was the reason to build this project, just let travis do the pushing to gh-pages.

Install

  • npm install
  • ???

How to use

  1. generate the secure string in order to create the string you must have created the repo on travis!!!
  2. call push2gh-pages script to push the built files

in .travis.yml define

  1. GH_EMAIL
  2. GH_REF
  3. secure - content generated by create-travis-secure script