Skip to content

Instantly share code, notes, and snippets.

@adesmier
Last active January 15, 2017 16:38
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 adesmier/80c398f30a762810b8d40f484e2a9802 to your computer and use it in GitHub Desktop.
Save adesmier/80c398f30a762810b8d40f484e2a9802 to your computer and use it in GitHub Desktop.
Codeship Rakefile to build Jekyll and push to BitBucket
require 'tmpdir'
desc "Generate jekyll site"
task :generate do
puts "## Grabbing data from Contentful..."
system "bundle exec jekyll contentful"
puts "## Creating posts from data files..."
system "ruby dataToPosts.rb"
puts "## Generating Site with Jekyll..."
system "bundle exec jekyll build"
end
desc "Generate and publish blog to Bitbucket"
task :publish do
Dir.mktmpdir do |tmp|
system "mv _site/* #{tmp}"
system "git checkout -b aerobatic"
system "rm -rf *"
system "mv #{tmp}/* ."
system 'git config --global user.email "user@email.co.uk"'
system 'git config --global user.name "User Name"'
system "git add ."
system "git commit -am 'Rebuild triggered from Contentful webhook --skip-ci'"
system "git remote add bb git@bitbucket.org:ianarber/ianarber.git"
system "git push -f bb aerobatic"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment