#!/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")