Set up a Git-based workflow with Local and GitHub Actions
Channel: WP Engine Builders
Date: 26/06/2023

Having an established end-to-end workflow for your site development process with Git version control can allow you to onboard a new developer quickly, keep a history of changes and elevate the consistency and quality of products for clients. Build quickly with Local, stage and keep a history with Git and GitHub Action, promote to production website when ready, and continue the process with maintaining an up-to-date local environment with Local Connect.

We’ll explore the following:

✔️ Set up a Local site for a local development environment and establish a connection to your production site with Local Connect (WP Engine customers only)

✔️ Organize and initialize Git version control in your Local WordPress development site’s wp-content directory and push up changes to GitHub

✔️ Set up GitHub Actions within your repository to trigger deployments to multiple environments: Development, Staging, Production

✔️ Leverage Local Connect to pull down the latest database changes from a Production environment

Jump to:
00:00 Intro
01:36 Overview & definitions
04:36 Goals & steps
07:11 Set up a new development site in Local
08:50 Add Frost theme and Yoast SEO plugin
10:44 Set up .gitignore
13:17 Considerations for what to track vs what NOT to track in Git
14:54 Smart Plugin Manager (SMP)
15:56 Final .gitignore example walkthrough
17:35 Question: Why track only the wp-content/ directory?
19:00 Initialize Git in wp-content/ directory with GitHub Desktop
21:50 Add WP Engine-specific GitHub Actions
26:22 Create a new site in the WP Engine portal
31:56 Create a staging environment in the WP Engine portal
32:50 Publish local repo to GitHub
35:02 Generate SSH keys for GitHub Actions
38:00 Add SSH public key to WP Engine portal
39:07 Add SSH private key to GitHub repo
40:26 Re-trigger GitHub Action for deployment
42:45 Debugging an issue with the deployment target
44:52 Solution: use REMOTE_PATH in GitHub Action
47:44 Activate Frost theme and Yoast on the production site
49:16 Create and push a new stage branch
50:00 Activate Frost theme and Yoast on the staging site
50:25 Set up production data synching with Local Connect
52:00 Setting up Local Connect with WP Engine
52:25 Enable API access in the WP Engine portal
52:47 Generate API credentials in the WP Engine portal for Local Connect
53:32 Initialize environment sync in Local Connect
57:40 Test new feature scenario
59:44 Wrap up

Related resources:
- Download Local: https://localwp.com
- GitHub Actions config example: https://gist.github.com/colorful-tones/bad9c34440dab1f37f0f90122fc04184
- Example .gitignore: https://gist.github.com/colorful-tones/9adeab19373a0b3693795f199b188c8c
- WPEngine.com "Development Best Practices (with Version Control)" https://wpengine.com/support/development-workflow-best-practices/
- WP Engine's Deploy WordPress to WP Engine GitHub Action documentation https://github.com/marketplace/actions/deploy-wordpress-to-wp-engine