Skip to content

Instantly share code, notes, and snippets.

@dwaghmare
Last active August 29, 2015 14:21
Show Gist options
  • Save dwaghmare/1215979edb92c7f1fa0a to your computer and use it in GitHub Desktop.
Save dwaghmare/1215979edb92c7f1fa0a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Sample Deployment Script
set -o errexit
echo -e "What tag would you like to deploy? (e.g., 2013-04-23.0) "
read tag
echo -e "Is this your staging environment? (y)es or (n)o: "
read stage
if [[ $stage = y ]] ; then
echo "Beginning production database pull down… "
# code to sql-sync production to staging with database sanitization
if [ "$?" -ne 0 ]
then
echo "There was an error pulling down the production database.";
else
echo "Production database pulled down successfully.";
fi
fi
echo "Beginning git repository pull and tag $tag checkout… "
git pull
git checkout $tag
if [ "$?" -ne 0 ]
then
echo "There was an error pulling and checkout out the code.";
else
echo "Code pulled and checked out successfully.";
fi
echo "Beginning Drupal database update… "
drush updatedb -y
if [ "$?" -ne 0 ]
then
echo "There was an error updating the database.";
else
echo "Database updated successfully.";
fi
echo "Beginning features reversion… "
drush features-revert-all -y
if [ "$?" -ne 0 ]
then
echo "There was an error reverting all features.";
else
echo "Features reverted successfully.";
fi
echo "Beginning Drupal cache clear… "
drush cc all
if [ "$?" -ne 0 ]
then
echo "There was an error clearing the Drupal cache.";
else
echo "Cache cleared successfully.";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment