Using capistrano to deploy from different git branches

前端 未结 13 1092
小鲜肉
小鲜肉 2020-12-22 16:03

I am using capistrano to deploy a RoR application. The codebase is in a git repository, and branching is widely used in development. Capistrano uses deploy.rb f

13条回答
  •  北荒
    北荒 (楼主)
    2020-12-22 16:08

    This works with Capistrano >= 3.1:

    add this line to config/deploy.rb:

    set :branch, ENV['BRANCH'] if ENV['BRANCH']
    

    and then call capistrano with:

    cap production deploy BRANCH=master
    

    This solution works with Capistrano < 3.1:

    # call with cap -s env="" branch="" deploy
    
    set :branch, fetch(:branch, "master")
    set :env, fetch(:env, "production")
    

提交回复
热议问题