Skip to main content
< All Topics

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:

ParameterDescription
secretYour API secret key (found in Deployer for Git → Miscellaneous)
typeplugin or theme
packageThe slug of your installed package

Step 1 – Copy Your Push-to-Deploy URL

  1. In your WordPress admin, go to Deployer for Git → Dashboard.
  2. Find the plugin or theme you want to auto-deploy.
  3. 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.

  1. Go to your repository → Settings → Secrets and variables → Actions.
  2. Click New repository secret.
  3. Name it DFG_THEME_DEPLOY_URL or DFG_PLUGIN_DEPLOY_URL and paste your full push-to-deploy URL as the value.
  4. 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

  1. You push a change to your main branch.
  2. GitHub Actions triggers the deploy workflow.
  3. The curl step calls your WordPress site’s push-to-deploy URL.
  4. Deployer for Git downloads the latest zip from GitHub and installs it.
  5. 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_STAGINGDFG_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 10 before the curl call 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.