Skip to content

Instantly share code, notes, and snippets.

@ghiculescu
Last active December 21, 2015 18:59
Show Gist options
  • Save ghiculescu/6351293 to your computer and use it in GitHub Desktop.
Save ghiculescu/6351293 to your computer and use it in GitHub Desktop.
Capistrano tasks to deploy Jekyll blog via :copy
set :application, `your_app_name`
set :repository, '_site'
set :scm, :none
set :deploy_via, :copy
set :copy_compression, :gzip
set :use_sudo, false
set :user, `name_of_a_user_on_your_vps` # by default this could be "root" but it's good practice to create another user
set :deploy_to, `path_on_vps_to_deploy_to` # for example, "/home/#{user}/blog" - you can use other variables (defined using `set`) here, eg. user
role :web, `ip_address_of_your_vps`
before 'deploy:update', 'deploy:update_jekyll'
namespace :deploy do
[:start, :stop, :restart, :finalize_update].each do |t|
desc "#{t} task is a no-op with jekyll"
task t, :roles => :app do ; end
end
desc 'Run jekyll to update site before uploading'
task :update_jekyll do
# clear existing _site
# build site using jekyll
# remove Capistrano stuff from build
%x(rm -rf _site/* && jekyll build && rm _site/Capfile && rm -rf _site/config)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment