2

I've followed this for several of our projects. It works wonderfully, except grabbing the latest git tag. For example, if I have tags 1,2,3,4,5,6,7,8,9,10, Capifony will try to deploy tag 9 because it sees that as the latest tag using the code provided on that how-to.

How can I change the following line to always get the latest tag?

set :branch, `git tag`.split("\n").last
nwalke
  • 3,170
  • 6
  • 35
  • 60

2 Answers2

3

The output of git tag is alphabetical. How 'bout git tag | sort -n?

Alternatively you could perform a numeric sort on the result of the split before grabbing the last entry.

tjd
  • 4,064
  • 1
  • 24
  • 34
0

git tag --sort=version:refname will sort this kind of tag properly.

bovender
  • 1,838
  • 15
  • 31