name: Deploy to WordPress.org

# Publishes a release to the wordpress.org SVN repository when a version tag is
# pushed (e.g. v0.4.0). The 10up action reads .distignore to decide what ships,
# pushes the filtered tree to trunk/, and creates tags/<version>/.
#
# The runtime widget assets (assets/widget.js, widget.css, bootstrap.js) are
# committed, so no build step runs here — checkout + deploy is enough.

on:
  push:
    tags:
      - 'v*'

jobs:
  deploy:
    name: New release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: WordPress Plugin Deploy
        id: deploy
        uses: 10up/action-wordpress-plugin-deploy@stable
        with:
          generate-zip: true
        env:
          SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
          SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
          SLUG: aisthetix-virtual-try-on

      - name: Upload release zip artifact
        uses: actions/upload-artifact@v4
        with:
          name: aisthetix-virtual-try-on
          path: ${{ steps.deploy.outputs.zip-path }}
