Skip to content

Instantly share code, notes, and snippets.

@imiroslavov
Created December 10, 2019 08:12
Show Gist options
  • Save imiroslavov/f50af20e5613304292739ad1c71efde3 to your computer and use it in GitHub Desktop.
Save imiroslavov/f50af20e5613304292739ad1c71efde3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ "$#" -ne 2 ]; then
echo "Usage: ./update.sh <branch> <environment>"
exit 1
fi
BRANCH=${1}
export APP_ENV=${2}
echo `date` "Entering project directory" && cd /srv && \
echo `date` "Starting maintenance mode" && touch public/.maintenance && \
echo `date` "Resetting possible changes" && git reset --hard HEAD && \
echo `date` "Pulling the latest changes" && git pull --rebase origin ${BRANCH} && \
echo `date` "Installing composer packages" && composer install --no-dev --optimize-autoloader && \
echo `date` "Dumping .env.local.php" && composer dump-env ${APP_ENV} && \
echo `date` "Running doctrine migrations " && php bin/console doctrine:migrations:migrate --allow-no-migration --no-interaction --env=${APP_ENV} --no-debug && \
echo `date` "Cleaning application cache" && php bin/console cache:clear --env=${APP_ENV} --no-debug --no-warmup && \
echo `date` "Stopping maintenance mode" && rm public/.maintenance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment