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)
|
||||||
|
CURR_BRANCH=$(git symbolic-ref --short HEAD)
|
||||||
|
if [[ ${CURR_BRANCH} == "main" ]]; then
|
||||||
|
echo pushing main to prod...
|
||||||
git checkout prod
|
git checkout prod
|
||||||
git merge --ff-only main
|
git merge --ff-only main
|
||||||
git push origin prod
|
git push origin prod
|
||||||
git checkout main
|
git checkout main
|
||||||
|
else
|
||||||
|
echo "This script is meant to be run from the main branch!"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue