build(release): exit early if not on main branch
MODIFY
script/release
script/release
@@ -4,6 +4,10 @@ fetch() {
git fetch --all
}
+branch_name() {
+ git symbolic-ref --short HEAD
+}
+
local_history_is_clean() {
history=$(git rev-list --count --right-only @{u}...HEAD)
[ "$history" == "0" ]
@@ -99,6 +103,11 @@ main() {
exit 1
fi
+ if [ "$(branch_name)" !== "main" ]; then
+ echo "Error: can only make a release on the main branch"
+ exit 1
+ fi
+
fetch
if ! remote_history_is_clean; then
echo "Error: changes exist on origin not pulled into this branch. Please pull"

build(release): exit early if not on main branch