Last active
August 11, 2021 10:17
-
-
Save toabr/2a5c1cface37169d13c8338d7eb5a4e1 to your computer and use it in GitHub Desktop.
Drupal 8 deployment script via git (bare repository)
This file contains 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 | |
# @file | |
# deploy Production the Environment | |
SOURCE="@self" | |
TARGET="@live" | |
FORMAT='\e[1;33m#' | |
RESET='\033[0m' # No Color | |
# prompt user for commit message | |
read -p "$(echo $FORMAT "Commit Message: "$RESET)" MESSAGE | |
# check for empty commit message | |
if [ "$MESSAGE" != "" ]; then | |
## export latest configs | |
drush $SOURCE config:export | |
## deploy the latest code | |
git add . | |
git commit -a -m "$MESSAGE" | |
git push live master | |
## install packages | |
drush $TARGET ssh composer install --no-dev | |
drush $TARGET updatedb | |
## import uploaded configs | |
drush $TARGET -y state:set system.maintenance_mode 1 | |
drush $TARGET config:import | |
drush $TARGET cache:rebuild | |
drush $TARGET -y state:set system.maintenance_mode 0 | |
else | |
echo "You must provide a commit message!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment