image: php:latest

options:
  max-time: 5
pipelines:
  branches:
    development:
     - step:
         name: Build and deploy to staging
         caches:
          - composer
         script:
          - apt-get update && apt-get install -y unzip
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - apt-get -qq install git-ftp
          - git ftp push --user $FTP_USERNAME_STAGING_NEW --passwd $FTP_PASSWORD_STAGING_NEW $FTP_HOST_PATH_STAGING_NEW
    master:
     - step:
         script:
          - echo "To initiate manual build from master branch to production server, push the Run button"
     - step:
         name: Build and deploy to production
         trigger: manual
         caches:
          - composer
         script:
          - apt-get update && apt-get install -y unzip
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - apt-get -qq install git-ftp
          - git ftp push --user $FTP_USERNAME_PROD_NEW --passwd $FTP_PASSWORD_PROD_NEW $FTP_HOST_PATH_PROD_NEW