Last active
August 29, 2015 14:16
-
-
Save andersondias/90a0eb445e463a1a93d9 to your computer and use it in GitHub Desktop.
Git Release
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# usage: git-release branch-name-1 branch-name-2 origin/remote-branch-name-3 | |
branchs = ARGV[0..-1] | |
abort unless system("git checkout master") | |
abort unless system("git pull") | |
abort unless system("git remote prune origin") | |
system("gitk") | |
print("Informe qual a tag que será usada nesse release: ") | |
tag = STDIN.gets.chomp | |
if branchs.size > 1 | |
abort unless system("git checkout -b ad-release") | |
branchs.each do |branch| | |
abort unless system("git merge --no-edit --no-ff #{branch}") | |
end | |
abort unless system("git checkout master") | |
abort unless system("git merge --no-edit --no-ff ad-release") | |
abort unless system("git branch -d ad-release") | |
else | |
abort unless system("git merge --no-edit --no-ff #{branchs.first}") | |
end | |
abort unless system("git push") | |
branchs.each do |branch| | |
if branch.include?('origin/') | |
abort unless system("git push origin :#{branch.gsub('origin/', '')}") | |
else | |
abort unless system("git branch -d #{branch}") | |
abort unless system("git push origin :#{branch}") | |
end | |
end | |
abort unless system("git tag #{tag}") | |
abort unless system("git push --tags") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment