image: atlassian/default-image:4

pipelines:
  branches:
   main:
      - step:
          name: "Deploy to BlokDev"
          deployment: staging-blokdev
          trigger: automatic
          script:
            - pipe: atlassian/rsync-deploy:0.11.0
              variables:
                USER: $USER5
                SERVER: $SERVER5
                REMOTE_PATH: "/var/www/html/wp-content/plugins/lofty-idx/"
                LOCAL_PATH: "."
                DEBUG: "true"
            - pipe: atlassian/ssh-run:0.8.0
              variables:
                SSH_USER: $USER5
                SERVER: $SERVER5
                COMMAND: |
                  find /var/www/html/wp-content/plugins/lofty-idx/ -path "/var/www/html/wp-content/plugins/lofty-idx/cache" -prune -o -type d -exec chmod 755 {} +
                  find /var/www/html/wp-content/plugins/lofty-idx/ -path "/var/www/html/wp-content/plugins/lofty-idx/cache" -prune -o -type f -exec chmod 644 {} +

      - step:
          name: "Deploy to BlokPrd"
          deployment: production-blokprd
          trigger: manual
          script:
            - pipe: atlassian/rsync-deploy:0.11.0
              variables:
                USER: $USER4
                SERVER: $SERVER4
                REMOTE_PATH: "/var/www/html/wp-content/plugins/lofty-idx/"
                LOCAL_PATH: "."
                DEBUG: "true"
            - pipe: atlassian/ssh-run:0.8.0
              variables:
                SSH_USER: $USER4
                SERVER: $SERVER4
                COMMAND: |
                  find /var/www/html/wp-content/plugins/lofty-idx/ -path "/var/www/html/wp-content/plugins/lofty-idx/cache" -prune -o -type d -exec chmod 755 {} +
                  find /var/www/html/wp-content/plugins/lofty-idx/ -path "/var/www/html/wp-content/plugins/lofty-idx/cache" -prune -o -type f -exec chmod 644 {} +