Skip to content

Instantly share code, notes, and snippets.

@ryanburnette
Last active June 7, 2020 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanburnette/9e4f20718b845923f6d7 to your computer and use it in GitHub Desktop.
Save ryanburnette/9e4f20718b845923f6d7 to your computer and use it in GitHub Desktop.
Capistrano Deployment By Semantic Version Tag In Git https://ryanburnette.com/blog/capistrano-deployment-by-tag
# deploy.rb
set :branch, Proc.new {
tags = `git tag`.split("\n")
vers = {}
tags.each do |t|
v = t.gsub('v','')
vers[v] = t
end
sorted_vers = vers.keys.sort { |x,y| Gem::Version.new(x) <=> Gem::Version.new(y) }
vers[sorted_vers.last]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment