Deploy Your Plugin to the WordPress.org Repository Using GitHub Actions

Automating the deployment of your WordPress plugin to the WordPress.org repository can save you time and ensure a smooth release process. With GitHub Actions and the 10up/action-wordpress-plugin-asset-update action, you can streamline this process. Here’s how to set it up:

Step 1: Prepare Your Plugin

Ensure your plugin follows WordPress.org guidelines and includes the necessary files (readme.txt, plugin header, etc.).

Step 2: Create GitHub Repository

Host your plugin code in a GitHub repository. Make sure your repository is public.

Step 3: Set Up GitHub Actions Workflow

In your GitHub repository, create a .github/workflows/deploy.yml file with the following configuration:

name: Deploy to WordPress.org

on:
  push:
    tags:
      - '*'

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Run build script
        run: |
          # Add your build scripts here, e.g., npm install && npm run build

      - name: WordPress Plugin Asset Update
        uses: 10up/action-wordpress-plugin-asset-update@v1.3.1
        with:
          # Your WordPress.org plugin repository name
          plugin-slug: your-plugin-slug
          # WordPress.org username and password (use GitHub Secrets)
          svn-username: ${{ secrets.WP_ORG_USERNAME }}
          svn-password: ${{ secrets.WP_ORG_PASSWORD }}

Step 4: Configure Secrets

In your GitHub repository, go to Settings > Secrets and variables > Actions > New repository secret and add the following secrets:

  • WP_ORG_USERNAME: Your WordPress.org username.
  • WP_ORG_PASSWORD: Your WordPress.org password.

Step 5: Push Tags to Trigger Deployment

Tag your release in GitHub to trigger the workflow:

git tag v1.0.0
git push origin v1.0.0

This will initiate the GitHub Actions workflow, running the build script and deploying your plugin to the WordPress.org repository.

Conclusion

Using GitHub Actions to deploy your WordPress plugin simplifies the release process, making it more efficient and reliable. By following the steps above, you can automate your deployments and focus more on developing great plugins.

For more detailed information, check out the 10up/action-wordpress-plugin-asset-update documentation.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *