# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1.29

pipelines:
  branches:
    master: # Pipeline to be run on the master branch
    - step:
        name: Deploy to sandbox
        deployment: sandbox
        # trigger: manual  # Uncomment to make this a manual deployment.
        script:
          # set file/folder permissions for apache
          - find ${BITBUCKET_CLONE_DIR}/ -type d -exec chmod 755 {} \;
          - find ${BITBUCKET_CLONE_DIR}/ -type f -exec chmod 644 {} \;
          - pipe: atlassian/rsync-deploy:0.4.3
            variables:
              USER: sandboxfiles
              SERVER: 197.242.149.86
              REMOTE_PATH: public_html
              LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/'
              DELETE_FLAG: 'false'
              EXTRA_ARGS: '--checksum --exclude .git/'
              # DEBUG: '<boolean>' # Optional
              # DELETE_FLAG: '<boolean>' # Optional.
    - step:
        name: Deploy to production
        deployment: production
        trigger: manual  # Uncomment to make this a manual deployment.
        script:
          # set file/folder permissions for apache
          - find ${BITBUCKET_CLONE_DIR}/ -type d -exec chmod 755 {} \;
          - find ${BITBUCKET_CLONE_DIR}/ -type f -exec chmod 644 {} \;
          - pipe: atlassian/rsync-deploy:0.4.3
            variables:
              USER: storage
              SERVER: 197.242.149.86
              REMOTE_PATH: public_html
              LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/'
              DELETE_FLAG: 'false'
              EXTRA_ARGS: '--checksum --exclude .git/'
              # DEBUG: '<boolean>' # Optional
              # DELETE_FLAG: '<boolean>' # Optional.