'Deployment to GitHub pages is introduced' post illustration

Deployment to GitHub pages is introduced


There's been three weeks since we made first public release of Grain and we're back to share some release news with you. First of all, we'd like to thank to all the people, who showed interest in our product and helped us by making first contributions or posting thoughtful feedbacks, your help is really valuable for us.

Along the last few days we have released 0.5.1 version of Grain, and versions 0.3.3 of Octopress and Template themes. You can check out the latest versions and the complete changelog on the release pages of these projects. Latest Octopress theme available here, and Template theme could be found here.

With Grain 0.5.1 we introduced one small, but important feature, now you can set closures to be executed as deploy commands. To put it shortly, now you can simply write this in the SiteConfig.groovy file of any Grain theme:

deploy = {
  //put custom deploy logic here

And then the logic, encapsulated in the closure, will be executed when you call standard ./grainw deploy from the command line.

The described feature was used in the new releases of Octopress and Template themes for introducing the smooth integration with GitHub Pages service. Now deploying your site to GitHub will take no time, and will consist of a few simple steps:

  • Create a repo you want to deploy your site to on GitHib. When creating a repo, follow the rules described on service's homepage: name repo username.github.io if you want to create personal/organization page, or name repo by project name, for project site. There's nothing else you need to do beforehand.

  • Set gh_pages_url property in SiteConfig.groovy to the link to created repo. The link should be provided in the following format: git@github.com:username/repo.git

  • Make sure deploy property in SiteConfig.groovy points at closure returned by the expression: new GHPagesDeployer(site).deploy.

  • Make sure that url property in prod settings of environments section of SiteConfig.groovy is set to the future url. Your site will be available on address username.github.io, if you are deploying a user/organization page, or on username.github.io/repo, if you are deploying a project site.

  • Call ./grainw deploy to deploy already generated site, or call ./grainw gendeploy to generate and deploy. Your site will be up in a few minutes since then.

As always, we'd love to hear feedback or questions on our mailing list, and we'd appreciate reporting about the issues.

If you're looking for a developer or considering starting a new project,
we are always ready to help!