Skip to content

Instantly share code, notes, and snippets.

@piyo7
Created September 29, 2015 00:45
Show Gist options
  • Save piyo7/fd0f8d1f5a3a89650c76 to your computer and use it in GitHub Desktop.
Save piyo7/fd0f8d1f5a3a89650c76 to your computer and use it in GitHub Desktop.
Gitにリリースタグを打つRakeタスク ref: http://qiita.com/piyo7/items/eee68999d5f74a2266ce
require "open3"
require "time"
task :add_release_tag do
day = Time.now.strftime("%Y%m%d")
ver = 0
tag = "#{day}.#{ver}"
while Open3.capture3("git show #{tag}")[2].exitstatus == 0
ver += 1
tag = "#{day}.#{ver}"
end
`git tag -a #{tag} -m "release tag by rake"`
`git push #{ENV["REMOTE_REPOGITORY"]} --tags`
end
task :release => [:prepare, :deploy, :add_release_tag]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment