Skip to content

Commit

Permalink
Merge pull request #119 from platformsh-templates/bug-114-115
Browse files Browse the repository at this point in the history
closes #114  #115
  • Loading branch information
chadwcarlson authored Jul 27, 2022
2 parents df2e3ce + 6e77c4f commit 8c63e54
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .platform.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ hooks:
deploy: |
set -e
php ./drush/platformsh_generate_drush_yml.php
cd web
drush -y cache-rebuild
drush -y updatedb
drush -y config-import
# if drupal is installed, will call the following drush commands:
# - `cache-rebuild`
# - `updatedb`
# - and if config files are present, `config-import`
./drush/platformsh_deploy_drupal.sh
# The configuration of app when it is exposed to the web.
web:
Expand Down Expand Up @@ -153,4 +154,4 @@ source:
auto-update:
command: |
curl -fsS https://raw.githubusercontent.com/platformsh/source-operations/main/setup.sh | { bash /dev/fd/3 sop-autoupdate; } 3<&0
19 changes: 19 additions & 0 deletions drush/platformsh_deploy_drupal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# We don't want to run drush commands if drupal isn't installed.
# Similarly, we don't want to attempt to run config-import if there aren't any config files to import
# @todo expand further to pass --uri for all sites, with an eye towards multisite
#


if [ -n "$(drush status bootstrap)" ]; then
drush -y cache-rebuild
drush -y updatedb
if [ -n "$(ls $(drush php:eval "echo realpath(Drupal\Core\Site\Settings::get('config_sync_directory'));")/*.yml 2>/dev/null)" ]; then
drush -y config-import
else
echo "No config to import. Skipping."
fi
else
echo "Drupal not installed. Skipping standard Drupal deploy steps"
fi

0 comments on commit 8c63e54

Please sign in to comment.