How to integrate continuous integration and deployment with WordPress on App Service
Published May 18 2024 04:29 AM 1,236 Views
Microsoft

Why use Continuous integration and deployment with WordPress?

 

CI/CD is a system that automates steps in software delivery. For WordPress developers, it means less manual work: once you push updates, the system automatically tests and deploys them. It's like having a assistant that not only speeds up your work but also checks for errors with each update, ensuring your WordPress site runs smoothly. This constant testing and feedback loop means you can fix bugs quickly and improve your site continuously without disrupting the live version. In short, CI/CD makes your development process faster, more efficient, and less error prone.

 

How to get started with Continuous integration and deployment in WordPress on App Service?

 

Note: This code integration feature is currently enabled with WordPress on App Service images having tags PHP 8.2 or greater. https://github.com/Azure/wordpress-linux-appservice/tree/main?tab=readme-ov-file#image-details

 

Part 1: Before integrating code with Git, it is important to decide which files to include. It is recommended that you keep track of a smaller number of files. For example, keeping track of files in wp-content/uploads is inefficient as it might contain large static files. Instead, files like these must be stored on blob storage. Another example is wp_config.php file, since this file contains separate settings for development and production environments.

You should also choose to ignore WordPress core files if you are not making any changes to them.

 

This is a simple .gitignore file to get you started: (ref: https://github.com/github/gitignore/blob/main/WordPress.gitignore)

 

*~
*.log
.htaccess
wp-content/uploads/
wp-content/upgrade/
wp-content/cache/
wp-content/backups/
wp-content/backup-db/
wp-content/blogs.dir/
wp-content/advanced-cache.php
wp-content/object-cache.php
wp-content/wp-cache-config.php
sitemap.xml
sitemap.xml.gz

# WP Core
/wp-admin/
/wp-content/index.php
/wp-content/languages
/wp-content/plugins/index.php
/wp-content/themes/index.php
/wp-includes/
/index.php
/license.txt
/readme.html
/wp-*.php
/xmlrpc.php

# Configuration
wp-config.php

 

 

Part 2: Downloading WordPress code from App Service

 

Step 1: Go to Kudu dashboard https://<sitename>.scm.azurewebsites.net/newui (Ref: Kudu Dashboard explained)

Step 2: Go to file manager and download the /site/wwwroot folder as a zip file

abhishekreddy_0-1716031377784.png

 

Step 3: Extract the zip file, use the gitignore file from step 1, and push it to your remote repository.

 

Part 3: Enabling CI/CD with GitHub

 

Step 1: Go to Deployment Center on your app service dashboard.

Step 2: From the Source dropdown, select ‘GitHub’

Step 3: Select the repository and the branch from step 2.

abhishekreddy_1-1716031377791.png

 

Step 4: Select ‘Add a workflow’ from the workflow options.

Step 5: Under ‘Authentication settings’, it is recommended that you select User-assigned authentication type.

Step 6: Click on Save

abhishekreddy_2-1716031377798.png

 

 

Support and Feedback 

In case you need any support, you can open a support request at New support request - Microsoft Azure. 
 For more details about the offering, please visitAnnouncing the General Availability of WordPress on Azure App Service - Microsoft Tech Community. 

 If you have any ideas about how we can make WordPress on Azure App Service better, please post your ideas atPost idea · Community (azure.com) 
 
or you could email us atwordpressonazure@microsoft.com to start a conversation. 

 

Co-Authors
Version history
Last update:
‎May 18 2024 04:30 AM
Updated by: