add safeguard against running from another branch than main in push-to-prod script
This commit is contained in:
parent
0c027dc29a
commit
cb2989a439
1 changed files with 11 additions and 5 deletions
|
@ -1,6 +1,12 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# push main to prod (which will trigger the deploy action)
|
# push main to prod (which will trigger the deploy action)
|
||||||
git checkout prod
|
CURR_BRANCH=$(git symbolic-ref --short HEAD)
|
||||||
git merge --ff-only main
|
if [[ ${CURR_BRANCH} == "main" ]]; then
|
||||||
git push origin prod
|
echo pushing main to prod...
|
||||||
git checkout main
|
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
|
||||||
|
|
Loading…
Reference in a new issue