- Create a Bitbucket Repository: If you don’t already have a Bitbucket repository for your WordPress project, create one by logging in to your Bitbucket account and selecting “Create repository.” Provide the necessary details and initialize it with your project code.
- Generate API Key in WP Engine: Log in to your WP Engine account and navigate to the “User Portal.” Go to the “API Keys” section and generate a new API key. Take note of the key, as you will need it later to authorize Bitbucket to access your WP Engine environment.
- Configure Bitbucket Pipeline Settings: In your Bitbucket repository, go to “Settings” and select “Pipelines.” Enable the Pipelines feature if it’s not already enabled. Bitbucket Pipelines use a configuration file called “bitbucket-pipelines.yml” to define the pipeline steps.
- Add WP Engine Deployment Steps: Open the “bitbucket-pipelines.yml” file in your repository and configure the deployment steps specific to WP Engine. This can include building the project, running tests, and deploying to WP Engine using the WP Engine deployment API.
- Add WP Engine Environment Variables: In the Bitbucket repository settings, go to “Settings” and select “Repository settings.” Navigate to “Pipelines” and then “Environment variables.” Add the necessary environment variables, including the WP Engine API key and other relevant details. These variables will be used in the deployment process.
- Commit and Push Changes: Save the changes made to the “bitbucket-pipelines.yml” file and commit them to your Bitbucket repository. Push the changes to trigger the pipeline.
- Monitor Deployment: Once the pipeline is triggered, Bitbucket Pipelines will run the defined steps, including the deployment to WP Engine. Monitor the pipeline execution logs for any errors or issues.
- Verify Deployment: After the pipeline completes successfully, visit your WP Engine account and check if the WordPress website has been deployed to the desired environment (e.g., staging or production).
By following these steps, you can connect Bitbucket and WP Engine, enabling seamless deployments of your WordPress projects using Bitbucket Pipelines. Remember to customize the deployment steps according to your project requirements and ensure that you have the necessary permissions and access rights in both Bitbucket and WP Engine.
Example bitbucket-pipelines.yml file
pipelines: branches: master: - step: name: Deploy to WP Engine script: - pipe: wpengine/wpe-site-deploy:v1 variables: WPE_SSHG_KEY_PRIVATE: $WPE_SSHG_KEY_PRIVATE WPE_ENV: '<envname>' REMOTE_PATH: 'wp-content/plugins/pluginname/'