mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-02-20 19:50:33 +09:00
Add safety checks to release script
This commit is contained in:
11
bin/release
11
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
|
||||
|
||||
Reference in New Issue
Block a user