pipelines:
  branches:
    master:
      - step:
          name: Deploy to Production
          deployment: production
          script:
            - pipe: atlassian/ssh-run:0.2.2
              variables:
                SSH_USER: 'jennyslerp'
                SERVER: '95.154.221.73'
                COMMAND: 'cd ~/${BITBUCKET_REPO_SLUG} && git checkout master && git pull origin master && composer install --no-dev --no-interaction --no-scripts  && composer dump-autoload -a && ./bin/console cache:clear && crontab docs/crontab'
                DEBUG: 'true'
  custom:
    rollback:
      - step:
          name: Rollback Production
          deployment: production
          script:
            - pipe: atlassian/ssh-run:0.2.2
              variables:
                SSH_USER: 'jennyslerp'
                SERVER: '95.154.221.73'
                COMMAND: 'cd ~/${BITBUCKET_REPO_SLUG} && git checkout `git log --branches=maste[r] --merges --grep="Merged in develop" --pretty=format:"%h" | head -2 | tail -1` && composer install --no-dev --no-interaction --no-scripts && composer dump-autoload -a && ./bin/console cache:clear && crontab docs/crontab'
                DEBUG: 'true'
