diff --git a/bin/release b/bin/release index 395088a..de4afcb 100755 --- a/bin/release +++ b/bin/release @@ -30,6 +30,17 @@ EXPORT_DEPLOY_LOCATION = "/local/app/product_releases/" abort "You must specify a version, e.g. `bin/release 1.0.0`" unless VERSION +current_branch = `git rev-parse --abbrev-ref HEAD`.strip +if current_branch != "main" + print "\e[1;33mWarning: You are on branch '#{current_branch}', not 'main'. Continue? [y/N] \e[0m" + abort "Release aborted." unless $stdin.gets.strip.downcase.chars.first == "y" +end + +unless `git status --porcelain`.strip.empty? + print "\e[1;33mWarning: You have uncommitted changes. Continue? [y/N] \e[0m" + abort "Release aborted." unless $stdin.gets.strip.downcase.chars.first == "y" +end + def announcing(message) puts "\n\e[1;36m#{message}\e[0m" yield