Created
December 4, 2020 08:19
-
-
Save opi/6b43a659f027322e216fb9d052f82fc5 to your computer and use it in GitHub Desktop.
Automate Drupal7 core update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function greenecho { | |
echo "" && echo -e "\e[30;48;5;82m ✔ $1 \e[0m" | |
} | |
function orangeecho { | |
echo "" && echo -e "\e[30;48;5;208m ⚠ $1 \e[0m" | |
} | |
greenecho "Here we are: "$(pwd) | |
#CONTRIB_NAME=$1 | |
# Update sources | |
greenecho "Update sources ..." | |
git pull --quiet origin master | |
greenecho "Check for outdated core" | |
CORE=$(drush pm-updatecode drupal -n --pipe) | |
if [ -n "$CORE" ] ; then | |
greenecho "Updating Drupal core" | |
drush up --quiet -y drupal > /dev/null | |
CORE_VERSION=$(drush status drupal-version --pipe --format=list) | |
git checkout -- .gitignore | |
git add --all . | |
git commit -m "[up] Drupal core $CORE_VERSION" | |
greenecho "Push updated sources" | |
git push origin master | |
else | |
orangeecho "Nothing to update" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment