# ─────────────────────────────────────────────────────────────────────────────
# Deploy to WordPress.org Plugin Directory
#
# Triggers automatically when you push a version tag (e.g. v1.0.0).
#
# Prerequisites:
#   1. Plugin approved and hosted on wordpress.org/plugins
#   2. Add these secrets in GitHub → Settings → Secrets → Actions:
#        SVN_USERNAME   — your wordpress.org username
#        SVN_PASSWORD   — your wordpress.org password
#   3. Set PLUGIN_SLUG below to match your wordpress.org plugin slug
#
# How to release:
#   git tag v1.0.0
#   git push origin v1.0.0
#
# The action will:
#   - Sync your repo to the WP.org SVN /trunk
#   - Create a new SVN tag matching the version
#   - Copy assets from .wordpress-org/ to the SVN assets directory
#     (place banner-1544x500.png, icon-256x256.png, screenshot-1.png etc. there)
# ─────────────────────────────────────────────────────────────────────────────

name: Deploy to WordPress.org

on:
  push:
    tags:
      - 'v*'           # matches v1.0.0, v1.1.0, v2.0.0, etc.

jobs:
  deploy:
    name: Push to WordPress.org SVN
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Deploy to WordPress.org
        uses: 10up/action-wordpress-plugin-deploy@stable
        env:
          SVN_PASSWORD:  ${{ secrets.SVN_PASSWORD }}
          SVN_USERNAME:  ${{ secrets.SVN_USERNAME }}
          SLUG:          dgn-webs-spam-user-cleaner
          ASSETS_DIR:    .wordpress-org
          BUILD_DIR:     .
