Skip to content

Instantly share code, notes, and snippets.

@sephlietz
Created February 18, 2014 17:05
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 sephlietz/9075099 to your computer and use it in GitHub Desktop.
Save sephlietz/9075099 to your computer and use it in GitHub Desktop.
Rake tasks to deploy jekyll build with rsync
desc "Build jekyll locally"
task :build do
sh "bundle exec jekyll build"
end
desc "Deploy _site"
task :deploy => :build do
user = 'user'
host = 'example.com'
release_dir = Time.new.strftime('%Y%m%d%H%M%S')
releases_path = "/var/www/example.com/public_html/releases/#{release_dir}/"
current_symlink = '/var/www/example.com/public_html/current'
sh "rsync -avz --delete _site/ #{user}@#{host}:#{releases_path}"
sh "ssh #{user}@#{host} 'ln -sfn #{releases_path} #{current_symlink}'"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment