22 lines
726 B
Bash
Executable file
22 lines
726 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
# ~SCRIPT~ update-hook.sh
|
|
# * Pass in a path to drush, or use a default:
|
|
# * Runs drush deploy command to update Drupal
|
|
|
|
# https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script
|
|
DIR="$( dirname -- "${BASH_SOURCE[0]}"; )"; # Get the directory name
|
|
SCRIPT_DIR="$( realpath -e -- "$DIR"; )"; # Resolve its full path if need be
|
|
|
|
drush=${*-${SCRIPT_DIR}/../vendor/bin/drush}
|
|
echo "Using drush=${drush}"
|
|
|
|
_oldpath=$PATH
|
|
export PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin
|
|
|
|
echo ">> [D] Running drush cache:rebuild"
|
|
${drush} cache:rebuild
|
|
echo ">> [D] Running drush deploy"
|
|
${drush} deploy -y
|
|
export PATH=$_oldpath
|
|
exit 0
|