Skip to content

Instantly share code, notes, and snippets.

@philwilliammee
Last active April 8, 2019 18:57
Show Gist options
  • Save philwilliammee/568f274c4e816b12527edee16789930f to your computer and use it in GitHub Desktop.
Save philwilliammee/568f274c4e816b12527edee16789930f to your computer and use it in GitHub Desktop.
Creates a Pantheon updates multidev. Applies upstream updates and drush updates
# d8 composer this requires a updates multidev will throw an error if cant delete
# typical usage as tooling
# tooling:
# update:
# service: appserver
# description: "Creates a Pantheon updates multidev. Applies upstream updates and drush updates"
# cmd: curl -s -L https://gist.githubusercontent.com/philwilliammee/568f274c4e816b12527edee16789930f/raw/D8_composer_lando_tooling.sh | bash
# user: root
# or lando ssh --user=root && curl -s -L https://gist.githubusercontent.com/philwilliammee/568f274c4e816b12527edee16789930f/raw/D8_composer_lando_tooling.sh | bash
# add confirmation
echo "[WARNING] This is a destructive action. stash local changes."
read -p "Do you want to continue? (Y/n) " -n 1 -r </dev/tty
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
terminus auth:login --machine-token=$TERMINUS_TOKEN &&
git pull --all &&
# if not on master branch swich to master branch
git checkout master --force &&
# kill the local updates branch since were killing it on Pantheon needs to check if branch exists
git branch -D updates --force &&
# it probably makes more sense to merge dev into updates but this way is inline with Bills script
terminus multidev:delete --delete-branch $TERMINUS_SITE.updates -y &&
echo "creating Pantheon multidev updates this may take awhile." &&
terminus multidev:create $TERMINUS_SITE.dev updates &&
# pull the new pantheon changes
git pull --all &&
git checkout updates --force &&
terminus drush $TERMINUS_SITE.updates ups &&
composer update &&
git config --global user.email "$TERMINUS_USER" &&
git config --global user.name "$LANDO_HOST_USER" &&
git add --all &&
git commit -m "composer_updates" &&
git push &&
terminus drush $TERMINUS_SITE.updates -- updb &&
terminus drush $TERMINUS_SITE.updates -- cr &&
terminus drush $TERMINUS_SITE.updates -- uli --uri=https://updates-$TERMINUS_SITE.pantheonsite.io
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment