Skip to content

Instantly share code, notes, and snippets.

@diegogurpegui
Last active October 11, 2018 23:14
Show Gist options
  • Save diegogurpegui/a24c7474ddcd16dc546d970ba40895b9 to your computer and use it in GitHub Desktop.
Save diegogurpegui/a24c7474ddcd16dc546d970ba40895b9 to your computer and use it in GitHub Desktop.
Script to deploy a Symfony project from a Git repository
#!/bin/bash
# Fetch from repository
git fetch origin
reslog=$(git log HEAD..origin/master --oneline)
git reset --hard origin/master
if [ "${reslog}" != "" ] ; then
git merge origin/master # completing the pull
# Symfony deployment
export SYMFONY_ENV=prod
composer install --no-dev --optimize-autoloader
# Clear Symfony cache
php bin/console cache:clear --env=prod --no-debug
# Dump assetic assets
php bin/console assetic:dump --env=prod --no-debug
# Remove cache dir so it can be created with httpd user
rm -R var/cache/prod
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment