Create a gist now

Instantly share code, notes, and snippets.

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