version: 2
jobs:
  build:
    working_directory: ~/build
    docker:
      - image: circleci/golang:latest
    steps:
      - checkout
      - setup_remote_docker:
          version: 19.03.13
      - run: make image
      - deploy: 
          command: |
            if [[ "$CIRCLE_BRANCH" == "master" ]]; then
              docker tag ctop quay.io/vektorlab/ctop:latest
              docker tag ctop quay.io/vektorlab/ctop:$(cat VERSION)
              docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
              docker push quay.io/vektorlab/ctop
            fi
