From b3d97ecb0efdec145c541ea8afa0f2ff450f68a1 Mon Sep 17 00:00:00 2001 From: "Stanko K.R." Date: Wed, 3 Dec 2025 08:24:04 +0100 Subject: [PATCH] Add safety checks to release script --- bin/release | 11 +++++++++++ 1 file changed, 11 insertions(+) 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