Created
February 18, 2014 17:05
-
-
Save sephlietz/9075099 to your computer and use it in GitHub Desktop.
Rake tasks to deploy jekyll build with rsync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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