3

I have a completely static site (eg. https://github.com/robertjchristian/angular-enterprise-seed) hosted on github, where I work mostly out of the master branch. The contents of the /app/ directory are byte-for-byte what I want to host. So during development I just cd ~/projects/angular-enterprise-seed/app, and then "python -m SimpleHTTPServer". This allows me to browse the site locally at localhost:8000.

I want to host the static contents of /app on the web as well, and gh-pages is the ideal candidate. Here are my requirements:

  • Don't want to "just use gh-pages branch as master"
  • Don't want to rely on a wrapper script that keeps gh-pages in line with master changes from the client.
  • Don't want to build out a service to handle the webhook post, checkout from master, and check into gh-pages.

Ideally it would be a github hook that says "Post commit hook - sync gh-pages with change in master"

Any ideas?

Thanks.

Robert Christian
  • 18,218
  • 20
  • 74
  • 89
  • I found a site that does exactly this but (a) can't find it now, and (b) it's in alpha and doesn't work yet. I ended up putting a bash script on PythonAnywhere.com and scheduling a 24 hr job that pulls master and updates gh-pages with the section containing the static site. Works like a charm and took ten minutes to setup. – Robert Christian Mar 20 '13 at 04:45
  • care to share that script? – ZachOfAllTrades Mar 28 '13 at 21:32

1 Answers1

0

After reading through a variety of different solutions for handling the sync between master and gh-pages, I ended up adopting an approached favored by JavaScript guru Sindre Sorhus and others:

  1. Make the gh-pages branch the default one on GitHub
  2. Delete the master branch
  3. Use the gh-pages branch as master.

You can see this on GitHub in Sindre's screenful.js repo, or in my project, selection-menu.

Community
  • 1
  • 1
Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404