Skip to content

Instantly share code, notes, and snippets.

@mandrius
Last active March 19, 2018 08:49
Show Gist options
  • Save mandrius/2e3ebe909615ed1c7fcd3b4e894f843c to your computer and use it in GitHub Desktop.
Save mandrius/2e3ebe909615ed1c7fcd3b4e894f843c to your computer and use it in GitHub Desktop.
GitLab CI/CD auto deploy (Drupal 8).
stages:
- deploy
dev-deployment:
stage: deploy
script:
- ssh HOST 'bash -s' < dev-deployment.sh
only:
- develop
prd-deployment:
stage: deploy
script:
- ssh HOST 'bash -s' < prd-deployment.sh
only:
- master
#!/bin/bash
set -e # We want to fail at each command, to stop execution.
cd /home/dev/web
# Make database dump.
#dump_file_name="HOST-develop-`date +%Y-%m-%d-%H%M`.sql.gz"
#drush sql-dump --gzip > ../../db/$dump_file_name
cd ..
git pull
# Commit database dump.
#git add db/$dump_file_name
#git commit -m "Database backup $dump_file_name"
#git push
# Run composer and import configs.
composer install
cd web
drush updb -y
drush cim -y
drush cr
#!/bin/bash
set -e # We want to fail at each command, to stop execution.
cd /home/master/web
# Make database dump.
dump_file_name="HOST-master-`date +%Y-%m-%d-%H%M`.sql.gz"
drush sql-dump --gzip > ../../db/$dump_file_name
cd ..
git pull
# Commit database dump.
#git add db/$dump_file_name
#git commit -m "Database backup $dump_file_name"
#git push
# Run composer and import configs.
composer install
cd web
drush updb -y
drush cim -y
drush cr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment