We use DeployHQ to automatically deploy code from GitHub to development and production sites on Pressable. Here is our workflow:
GitHub Branches and workflows
- The
trunkbranch deploys to the production Pressable environment automatically, and thedevelopbranch deploys to the development environment. - The repository deploys to the
wp-contentfolder. - When working on a bug or a new feature, commit and push your changes to a feature branch (for example
feature/new-featureorfix/broken-thing).- Please use
trunkas the base for your feature branch.
- Please use
- Testing on the development site
- Once you’re ready for testing on the dev site, create a PR to merge your feature branch into the
developbranch when you’re ready to test on the development site; the changes should be auto-deployed.
- Once you’re ready for testing on the dev site, create a PR to merge your feature branch into the
- Deploying to production
- The
trunkbranch is used for the production site. - When you’re ready to submit your code to the production site, create a PR from your feature branch to the
trunkbranch. - DO NOT MERGE
developINTOtrunk! - Once merged, DeployHQ will deploy the changes to the production site.
- The
Managing plugins
- Plugins do not need to be managed via Git unless they are custom plugins that you develop.
If they are critical to the site’s function, feel free to put them in themu-pluginsfolder.
Code checking and validation
- We validate all code against the WordPress-Extra ruleset – All PRs are auto-checked and must pass the checks before merging.
- This is a nice tutorial for setting up PHPCS and WordPress standards on a local macOS environment: https://javorszky.co.uk/2018/07/30/set-up-phpcs-and-wordpress-extra-coding-standards-and-configure-your-ides-to-use-them/.
- We usually run these commands before we commit or push:
- This will run the sniffer on all files in the directory you’re in
phpcs --standard=WordPress-Extra --extensions=php -psv - You can limit that to a single file, for example
phpcs --standard=WordPress-Extra -psv filename.php - And you can have it auto-fix lots of the formatting errors by running
phpcbf --standard=WordPress-Extra --extensions=php -psv
- This will run the sniffer on all files in the directory you’re in
If you run into any issues or need assistance, don’t hesitate to email us.
