How to Auto-Deploy Your WordPress Plugin or Theme with GitHub Actions
If you’re using Deployer for Git, you already know it can update your WordPress plugins and themes straight from a GitHub repository. But did you know you can make deployments happen automatically the moment you push to GitHub – with zero manual clicks.
That’s exactly what the plugin’s push-to-deploy URL is for, and GitHub Actions makes wiring it up dead simple.
What Is the Push-to-Deploy URL?
Deployer for Git exposes a REST API endpoint on your WordPress site:
https://yoursite.com/wp-json/dfg/v1/package_update?secret=YOUR_SECRET&type=plugin&package=your-plugin-slug
Hitting this URL (via GET or POST) tells WordPress to pull the latest zip from your repository and install it – the same as clicking “Update” in the dashboard, but triggered from outside.
The three required parameters are:
| Parameter | Description |
|---|---|
secret | Your API secret key (found in Deployer for Git → Miscellaneous) |
type | plugin or theme |
package | The slug of your installed package |
Step 1 – Copy Your Push-to-Deploy URL
- In your WordPress admin, go to Deployer for Git → Dashboard.
- Find the plugin or theme you want to auto-deploy.
- Copy the push-to-deploy URL shown there – it already has your secret and slug pre-filled.
Step 2 – Store Your Secret in GitHub
Never put your secret key directly in a workflow file. Use GitHub Secrets instead.
- Go to your repository → Settings → Secrets and variables → Actions.
- Click New repository secret.
- Name it
DFG_THEME_DEPLOY_URLorDFG_PLUGIN_DEPLOY_URLand paste your full push-to-deploy URL as the value. - Click Add secret.
Step 3 – Create the GitHub Actions Workflow
In your repository, create the file .github/workflows/deploy.yml:
name: Deploy to WordPress
on:
push:
branches:
- main # Change this to whatever branch you deploy from
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Trigger Deployer for Git
run: |
curl -s -o response.json -w "%{http_code}" \
--max-time 60 \
"${{ secrets.DFG_THEME_DEPLOY_URL }}" > http_code.txt
HTTP_CODE=$(cat http_code.txt)
echo "HTTP status: $HTTP_CODE"
cat response.json
if [ "$HTTP_CODE" != "200" ]; then
echo "Deployment failed with HTTP $HTTP_CODE"
exit 1
fi
Commit and push this file to your repository.
How It Works
- You push a change to your
mainbranch. - GitHub Actions triggers the
deployworkflow. - The
curlstep calls your WordPress site’s push-to-deploy URL. - Deployer for Git downloads the latest zip from GitHub and installs it.
- If you have cache flushing enabled in the plugin settings, your cache is cleared automatically too.
The workflow also checks the HTTP response code – if anything goes wrong (wrong secret, invalid package, server error), the Action will fail and you’ll get notified.
Targeting a Specific Branch
The push-to-deploy URL installs whatever branch you configured when you set up the package in Deployer for Git.
Tips
- Use environment-specific secrets – if you have staging and production sites, add separate secrets (
DFG_DEPLOY_PLUGIN_X_URL_STAGING,DFG_DEPLOY_PLUGIN_X_URL_PROD) and call them in separate workflow jobs. - Add a delay for large repos – if your repository is large and GitHub’s zip generation takes a moment, add a
sleep 10before thecurlcall to avoid the plugin fetching a stale zip. - Check the logs – Deployer for Git logs every webhook-triggered update under Deployer for Git → Logs, so you can confirm the deployment landed correctly.
That’s it – a fully automated push-to-deploy pipeline for your WordPress site, with no FTP, no SSH, and no manual updates required.