version: 2
make_run: &make_run
  docker:
    - image: golang:1.13.7
  steps:
    - checkout
    - run:
        name: Packer Run
        command: |
          set -e
          go build
          make $MAKE_COMMAND
jobs:
  lint:
    <<: *make_run
    environment:
      MAKE_COMMAND: "lint"
  test:
    <<: *make_run
    environment:
      MAKE_COMMAND: "test"
  build:
    <<: *make_run
    environment:
      MAKE_COMMAND: ""
  tagging:
    docker:
      - image: alpine/git:latest
    steps:
      - run:
          name: Update Tag
          command: |
            set -eu
            VERSION=$(git describe --abbrev=0 --tags)
            VERSION_BITS=(${VERSION//./ })

            VNUM1=${VERSION_BITS[0]}
            VNUM2=${VERSION_BITS[1]}
            VNUM3=${VERSION_BITS[2]}
            VNUM3=$((VNUM3+1))

            NEW_TAG="$VNUM1.$VNUM2.$VNUM3"

            git tag $NEW_TAG
            git push --tags

workflows:
  version: 2
  build_and_test:
    jobs:
      - lint
      - test
      - build:
          requires:
            - lint
            - test
      - tagging:
          filters:
            branches:
              only:
                - master

version: 2
make_run: &make_run
  docker:
    - image: golang:1.13.7
  steps:
    - checkout
    - run:
        name: Packer Run
        command: |
          set -e
          go build
          make $MAKE_COMMAND
jobs:
  lint:
    <<: *make_run
    environment:
      MAKE_COMMAND: "lint"
  test:
    <<: *make_run
    environment:
      MAKE_COMMAND: "test"
  build:
    <<: *make_run
    environment:
      MAKE_COMMAND: ""
workflows:
  version: 2
  build_and_test:
    jobs:
      - lint
      - test
      - build:
          requires:
            - lint
            - test

Revert "Enable Automatic Tagging in CircleCI"
Revert "Enable Automatic Tagging in CircleCI"
