Skip to content

Instantly share code, notes, and snippets.

@kopepasah
Created November 16, 2017 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kopepasah/9d952649b7ee3a9444cea850fc20127f to your computer and use it in GitHub Desktop.
Save kopepasah/9d952649b7ee3a9444cea850fc20127f to your computer and use it in GitHub Desktop.
Updates WordPress Core on the Pantheon hosting platform using Terminus.
#!/bin/bash
echo "Preparing update..."
terminus login --email=your@email.com -q
terminus connection:set site.dev sftp -q
echo "Validating update..."
if [[ $(terminus wp site.dev -- core check-update) == *"WordPress is at the latest version"* ]] 2>/dev/null; then
terminus wp site.dev -- core version --extra 2>/dev/null
echo "No WordPress Core update to apply."
echo "Exiting."
exit
else
terminus wp site.dev -- core update 2>/dev/null
fi
VERSION=$(terminus wp site.dev --no-ansi -- core version 2>/dev/null)
echo "Committing update..."
terminus env:diffstat site.dev -q
terminus env:commit site.dev --message="Update WordPress Core to $VERSION" 2>/dev/null
echo "Deploying to test..."
terminus deploy site.test --cc --note="Deploy WordPress Core $VERSION Update" 2>/dev/null
echo "Cleaning up..."
terminus connection:set site.dev git -q
echo "WordPress Updated to $VERSION on dev and test."
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment