image: composer:2.0

pipelines:
  branches:
    main:
      - step:
          name: Deploy to Production
          image: wagnerstephan/bitbucket-git-ftp:latest
          script:
          - git reset --hard HEAD
          - git clean -fdx
          - git stash drop || true # Garante que o stash não interfira
          - git pull origin main --rebase
          - git ftp push --force -u "$FTP_USER" -p "$FTP_PASS" ftp://$FTP_HOST/public_html --verbose


    develop:
      - step:
          name: Develop Environment
          image: wagnerstephan/bitbucket-git-ftp:latest
          script:
            - git reset --hard HEAD
            - git clean -fdx
            - git status
            - git pull origin develop --rebase
            - git ftp push --force -u "$FTP_USERNAME_DEV" -p "$FTP_PASSWORD_DEV" ftp://$FTP_HOST_DEV --verbose
