version: 2
jobs:
  build:
    docker:
      - image: docker:18.03.0-ce-git
    working_directory: ~/app
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: Install dependencies
          command: |
            apk add --no-cache \
              py-pip
            pip install \
              docker-compose==1.20.1
      - run:
          name: Start container and run tests
          command: |
            docker-compose run test rake

      - deploy:
          name: Deploy
          command: |
            if [ "${CIRCLE_BRANCH}" == "master" ]; then
              echo "Deploying to production"
              curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/Finding%20Aids/job/Finding%20Aids%20Production%20Deploy/build/api
            elif [[ "${CIRCLE_BRANCH}" =~ (feature|bug|hotfix|chore)\/(.+) ]]; then
              echo "Deploying to development"
              curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/Finding%20Aids/job/Finding%20Aids%20Development%20Deploy/build/api
            fi

version: 2
jobs:
  build:
    docker:
      - image: docker:18.03.0-ce-git
    working_directory: ~/app
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: Install dependencies
          command: |
            apk add --no-cache \
              py-pip
            pip install \
              docker-compose==1.20.1
      - run:
          name: Start container and run tests
          command: |
            docker-compose run test rake

      - deploy:
          name: Deploy
          command: |
            if [ "${CIRCLE_BRANCH}" == "master" ]; then
              echo "Deploying to production"
              curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/Finding%20Aids/job/Finding%20Aids%20Production%20Deploy/build/api
            elif [[ "${CIRCLE_BRANCH}" =~ (.+) ]]; then
              echo "Deploying to development"
              curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/Finding%20Aids/job/Finding%20Aids%20Development%20Deploy/build/api
            fi

Remove necessary branch prefix and default to anything besides master
Remove necessary branch prefix and default to anything besides master
