name: Update wordpress.org assets & readme

# Syncs the plugin listing (icon, banner, screenshots) and the readme.txt to the
# wordpress.org SVN repository whenever they change on main — no version bump or
# tag required. Listing images live in .wordpress-org/ (SVN's special assets/
# dir), kept out of the shipped plugin by .distignore.

on:
  # Manual trigger — needed for the first sync, since the listing images are
  # already committed and would not otherwise register as a change.
  workflow_dispatch:
  push:
    branches:
      - main
    paths:
      - '.wordpress-org/**'
      - 'readme.txt'

jobs:
  assets:
    name: Sync assets & readme
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Update wordpress.org plugin assets
        uses: 10up/action-wordpress-plugin-asset-update@stable
        env:
          SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
          SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
          SLUG: aisthetix-virtual-try-on
          ASSETS_DIR: .wordpress-org
