name: Deploy to Test Environment

on:
  push:
    branches:
      - develop

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        
      - name: Deploy to test environment
        run: |
          # Ustvari ciljni direktorij, če ne obstaja
          mkdir -p /home/spletnimojster-europewonder/htdocs/europewonder.spletnimojster.si/wp-content/themes/Arhiv
          
          # Kopiraj vse datoteke iz repozitorija v ciljni direktorij
          # Uporabi rsync za ohranitev datotek, ki niso v repozitoriju
          rsync -av --delete \
            --exclude='.git' \
            --exclude='.gitea' \
            --exclude='.github' \
            --exclude='README.md' \
            ./ /home/spletnimojster-europewonder/htdocs/europewonder.spletnimojster.si/wp-content/themes/Arhiv/
          
          echo "Theme deployed to test environment successfully!" 