如何将已部署的git修订写到Capistrano中的文件

Ron*_*ity 2 git capistrano

我使用Capistrano部署我的Rails应用程序。如何写出部署到public_html / revision.txt的git修订版?

Ron*_*ity 5

如果其他人必须这样做:

    namespace :deploy do
      # ...

      desc "Write the current version to public_html/revision.txt"
      task :write_revision, :except => { :no_release => true } do
        run "cd #{latest_release}; git rev-parse HEAD > #{latest_release}/public/revision.txt"
      end

      # ...
    end

    after "deploy:update_code", "deploy:write_revision"
Run Code Online (Sandbox Code Playgroud)