Skip to content

Instantly share code, notes, and snippets.

@jasonlancaster
Last active January 26, 2021 14:56
Show Gist options
  • Save jasonlancaster/dc98732a3d070fa6cead554046a995c0 to your computer and use it in GitHub Desktop.
Save jasonlancaster/dc98732a3d070fa6cead554046a995c0 to your computer and use it in GitHub Desktop.
Terminus/Pantheon blind automated deploy from dev to live
#!/bin/bash
# just a quick script i wrote to meet need to sometimes blind update a site with zero code review/testing :( but :)
# sometimes steps must be delayed due to pantheon not responding right away without a little delay in script timing (like committing and then immediately pushing)
# Jason Lancaster jlancaster@lmdagency.com
DELAY=10
function sleepme() {
echo "### sleeping for $DELAY seconds ###"
sleep $DELAY
}
read -p "Enter site (<site>.dev): " name
echo "Updating $name..."
#plugin updates
echo "running: terminus connection:set $name.dev sftp --yes"
terminus connection:set $name.dev sftp --yes
echo "running: terminus wp $name.dev -- plugin update --all"
terminus wp $name.dev -- plugin update --all
sleepme
echo "running: terminus env:commit $name.dev --message=Automated plugin updates"
terminus env:commit $name.dev --message="Automated plugin updates"
sleepme
#upstream updates
echo "running: switch to git mode"
terminus connection:set $name.dev git --yes
terminus upstream:updates:apply $name.dev
terminus env:clone-content --cc --yes -- $name.live dev
# Test the site (if testing)
#open https://dev-$name.pantheonsite.io/
# deploy to test and live
terminus env:deploy $name.test --sync-content --note="Automated deploy core and contrib plugin updates" --cc
terminus env:deploy $name.live --note="Automated deploy core and contrib plugin updates" --cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment