Skip to content

Instantly share code, notes, and snippets.

@opi
Created December 4, 2020 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opi/6b43a659f027322e216fb9d052f82fc5 to your computer and use it in GitHub Desktop.
Save opi/6b43a659f027322e216fb9d052f82fc5 to your computer and use it in GitHub Desktop.
Automate Drupal7 core update
#!/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