add safeguard against running from another branch than main in push-to-prod script

This commit is contained in:
Douze Bé 2024-09-26 22:26:07 +02:00
parent 0c027dc29a
commit cb2989a439

View file

@ -1,6 +1,12 @@
#!/bin/bash
#!/usr/bin/env bash
# push main to prod (which will trigger the deploy action)
CURR_BRANCH=$(git symbolic-ref --short HEAD)
if [[ ${CURR_BRANCH} == "main" ]]; then
echo pushing main to prod...
git checkout prod
git merge --ff-only main
git push origin prod
git checkout main
else
echo "This script is meant to be run from the main branch!"
fi