Last Updated: February 25, 2016
·
1.355K
· pleone

Capifony interactive branch tag deploy

If you want to deploy a specific tag using capifony (capistrano) you can specify it on your deploy.rb

set :branch, {branch}

or you can tell capistrano to ask it to you simply adding this lines to you capistrano script ( or in your Capfile ):

set :branch do
  default_tag = `git tag`.split("\n").last
  tag = Capistrano::CLI.ui.ask "Tag to deploy (make sure to push the tag first): [#{default_tag}] "
  tag = default_tag if tag.empty?
  tag
end  

This way you are overriding the method set :branch with your own code. Here we're using git tag to fetch the last tag and use as default in case you don't specify a tag on your command line.

Smart and useful! ;)