# 
version: 2
jobs:
  build:
    working_directory: /build
    docker:
      - image: docker:17.06.0-ce-git
    steps:
      - checkout
      - setup_remote_docker:
          reusable: true
          exclusive: true
      - run:
          name: Install bash
          command: apk add --no-cache bash
      - run:
          name: Build image
          command: bin/build.sh
      - deploy:
          name: Deploy image to Docker Hub
          branches:
            only:
              - master
          command: |
            docker login --username ${DOCKER_USER} --password ${DOCKER_PASSWORD}
            bin/deploy.sh
deployment:
  trigger_tag:
    tag: /v.*/

# 
version: 2
jobs:
  build:
    working_directory: /build
    docker:
      - image: docker:17.06.0-ce-git
    steps:
      - checkout
      - setup_remote_docker:
          reusable: true
          exclusive: true
      - run:
          name: Install bash
          command: apk add --no-cache bash
      - run:
          name: Build image
          command: bin/build.sh
      - deploy:
          name: Deploy image to Docker Hub
          command: |
            beginswith() { case $2 in "$1"*) true;; *) false;; esac; }
            if beginswith v "$CIRCLE_TAG" || [ ${CIRCLE_BRANCH} == "master" ]; then
              docker login --username ${DOCKER_USER} --password ${DOCKER_PASSWORD}
              bin/deploy.sh
            else
              echo "Skipping deploy"
            fi
deployment:
  trigger_tag:
    tag: /v.*/

Fix deploy logic as it wasn't working
Fix deploy logic as it wasn't working

branches:
  only:
    - master

Even with the above, it deployed with CIRCLE_BRANCH=feature/circleci
