WordPress Deployments Automation: Single Command Publishing with Buddy CI/CD
In this guide you will fully automate WordPress deployments.
Docker, Git and
oaicite:0
By using it, you will establish an error-free publishing process.
As soon as you call git push from the local environment, the theme will be automatically transferred to the live server.
Technical Summary
This guide covers automating WordPress theme deployments with CI/CD.
It completely eliminates manual FTP and file copying processes.
The flow is as follows:
- Local WordPress environment is set up with Docker
- Sage based custom theme is developed
- Code is pushed to Git repository
- Automatic distribution is made with Buddy pipeline
What Will You Learn in This Guide?
- Setting up a WordPress environment with Docker
- Developing modern WordPress themes with Sage
- Providing version control with Git
- Automatic deployment with Buddy CI/CD
- Go live with a single command
Prerequisites
-
Docker and Docker Compose
-
Git (GitHub or GitLab account)
-
PHP 7.2+
-
Nodejs 14+
-
Composer and Yarn
-
A running WordPress server (**
oaicite:1
**or similar)
1. Installing WordPress with Docker
First verify that Docker is running.
docker info
- This command checks that the Docker service is active.
Download the WordPress image.
docker pull wordpress
- This command pulls the latest WordPress Docker image.
Create the project folder.
mkdir docker-wordpress-theme && cd docker-wordpress-theme
- Create the Docker Compose file.
nano docker-compose.yml
version: "3.1"
services:
wordpress:
image: wordpress
restart: always
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
volumes:
- wordpress:/var/www/html
- ./sage:/var/www/html/wp-content/themes/sage/
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: "1"
volumes:
- db:/var/lib/mysql
volumes:
wordpress:
db:
- This structure supports WordPress and MySQL services.
2. Creating a Custom WordPress Theme with Sage
- Sage is the modern WordPress theme development engine.
- Build processes are moved to the CI/CD environment, not to the server.
composer create-project roots/sage
- This command creates the Sage startup theme.
- Choose Bootstrap when choosing the framework. Enter http://localhost:8080 as the local address.
3. Compiling and Running the Theme
- Enter the Sage folder.
cd sage
- Install the required dependencies.
yarn add node-sass -D
- Get production build.
yarn build:production
- Start the Docker environment.
cd ..
docker-compose up -d
Enter http://localhost:8080 from the browser.
- Complete the WordPress installation and activate the Sage theme.
4. Importing the Project to Git Repository
- Version control is the foundation of CI/CD.
git init
- Create the .gitignore file.
nano .gitignore
.cache-loader
composer.phar
dist
node_modules
vendor
- Perform the commit and push operation.
git add .
git commit -m "sage theme initial"
git push
5. Automatic Deployment Setup with Buddy
- Create a Buddy account and connect your Git repository.
- Set the Pipeline trigger to push.
Pipeline steps:
-
PHP Action
-
Node.js Action
-
Droplet Action
-
SSH Action
PHP Step
cd sage
composer validate
composer install
- This step installs PHP dependencies.
Node.js Step
cd sage
yarn install
yarn build:production
- This step compiles the theme assets.
Upload to Server
Source path: sage
-
Target path: /var/www/html/wp-content/themes/sage
-
Exclusions:
node_modules/
.cache-loader/
Theme Activation
sudo -u www-data -- wp theme activate sage/resources
- This command automatically activates the theme.
6. Testing Automatic Deployment
- Start the development server.
yarn start
- Make a minor change to the CSS.
git add .
git commit -m "style update"
git push
- Buddy pipeline runs automatically after push.
The live site is updated.
Frequently Asked Questions (FAQ)
1. Why should Buddy be preferred? Thanks to its visual interface, it does not require DevOps knowledge.
2. Is it possible to build on the server? No. Build is done entirely in the CI/CD environment.
3. Is FTP completely unnecessary? Yes. Git and pipeline manage everything.
4. Is only the theme distributed? No. Plugins and custom codes can also be distributed.
Result
Congratulations! You have established a structure that manages your WordPress project with fully automated CI/CD.
Now:
- You can go live with a single command
- You reduce the risk of errors
- You develop faster
- You can use the GenixNode infrastructure with peace of mind to run this structure on high-performance servers.

