Skip to content

Instantly share code, notes, and snippets.

@thedeerchild
Last active December 19, 2015 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thedeerchild/6026543 to your computer and use it in GitHub Desktop.
Save thedeerchild/6026543 to your computer and use it in GitHub Desktop.
Rakefile for deploying locally built Jekyll sites to GitHub. Taken shamelessly from http://ixti.net/software/2013/01/28/using-jekyll-plugins-on-github-pages.html
require 'jekyll'
# Change your GitHub reponame
GITHUB_REPONAME = "elm232/elm232.github.io"
desc "Generate blog files"
task :generate do
Jekyll::Site.new(Jekyll.configuration({
"source" => ".",
"destination" => "_site"
})).process
end
desc "Generate and publish blog to gh-pages"
task :publish => [:generate] do
Dir.mktmpdir do |tmp|
cp_r "_site/.", tmp
Dir.chdir tmp
system "git init"
system "git add ."
message = "Site updated at #{Time.now.utc}"
system "git commit -m #{message.shellescape}"
system "git remote add origin git@github.com:#{GITHUB_REPONAME}.git"
system "git push origin master --force"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment