Skip to content

Commit

Permalink
push to the right branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzsequence committed Sep 22, 2023
1 parent 8776dad commit f4b300b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions private/scripts/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ yellow=$(tput setaf 3)
sagename="${SAGENAME:-}"
is_ci="${CI:-}"
siteenv="${SITEENV:-dev}"
if [ "$siteenv" == "dev" ]; then
branch="master"
else
branch="$siteenv"
fi

# Main function that runs the script.
function main() {
Expand Down Expand Up @@ -249,7 +254,7 @@ function update_php() {
echo "php_version: 8.0" >> pantheon.yml
fi
git commit -am "[Sage Install] Update PHP version to 8.0"
git push origin master
git push origin $branch
else
echo "${green}PHP version is already 8.x.${normal}"
fi
Expand Down Expand Up @@ -286,7 +291,7 @@ function install_sage_theme() {
# Commit the theme
git add "$sagedir"
git commit -m "[Sage Install] Add the Sage theme ${sagename}."
git push origin master
git push origin $branch
echo "${green}Sage installed!${normal}"
}

Expand Down Expand Up @@ -320,7 +325,7 @@ EOF
ln -sfn uploads/cache .
git add .
git commit -m "[Sage Install] Add a symlink for /files/cache to /uploads/cache"
git push origin master
git push origin $branch
cd ../..
}

Expand Down Expand Up @@ -361,7 +366,7 @@ function update_composer() {
echo "${yellow}Updating composer.lock.${normal}"
git add composer.lock
git commit -m "[Sage Install] Update composer.lock"
git push origin master
git push origin $branch
fi

echo "${yellow}Attempting to add a post-install hook to composer.json.${normal}"
Expand Down Expand Up @@ -396,7 +401,7 @@ function update_composer() {
git add composer.json
git commit -m "[Sage Install] Add post-install-cmd hook to also run install on ${sagename}"

if ! git push origin master; then
if ! git push origin $branch; then
echo "${red}Push failed. Stopping here.${normal}"
echo "Next steps are to push the changes to the repo and then set the connection mode back to Git."
exit 1;
Expand Down

0 comments on commit f4b300b

Please sign in to comment.