Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capistrano 3: How to store git revision into a file?

Is there a way how to fetch a git revision variable from Capistrano 3?

I can't figure out how to access capistrano variables:

namespace :deploy do

  after :finished, :set_current_version do
    on roles(:app) do
      # dump current git version
      within release_path do
        execute :echo, "#{fetch(:revision_log_message)} >> public/version"
      end
    end
  end
end
like image 688
Tombart Avatar asked Jan 12 '23 00:01

Tombart


2 Answers

This one works

  after :finished, :set_current_version do
    on roles(:app) do
      # dump current git version
      within release_path do
        execute :echo, "#{capture("cd #{repo_path} && git rev-parse --short HEAD")} >> public/version"
      end
    end
  end
like image 143
Tombart Avatar answered Mar 13 '23 06:03

Tombart


This feature is added in 3.0.1, see their changelog!

like image 45
Lee Hambley Avatar answered Mar 13 '23 07:03

Lee Hambley