version: 2.1

executors:
  common-executor:
    working_directory: ~/go/src/github.com/Clever/discovery-go
    docker:
    - image: cimg/go:1.16
    environment:
      CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
      CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
      GOPRIVATE: github.com/Clever/*

commands:
  clone-ci-scripts:
    description: Clone the ci-scripts repo
    steps:
    - run:
        command: cd .. && git clone --depth 1 -v https://github.com/Clever/ci-scripts.git && cd ci-scripts && git show --oneline -s
        name: Clone ci-scripts

jobs:
  build:
    executor: common-executor
    steps:
    - checkout
    - run: make install_deps
    - run: make test
    - persist_to_workspace:
        root: ~/go/src/github.com/Clever
        paths: "."

version: 2.1

executors:
  common-executor:
    working_directory: ~/go/src/github.com/Clever/discovery-go
    docker:
    - image: cimg/go:1.16
    environment:
      CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
      CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
      GOPRIVATE: github.com/Clever/*

commands:
  clone-ci-scripts:
    description: Clone the ci-scripts repo
    steps:
    - run:
        command: cd .. && git clone --depth 1 -v https://github.com/Clever/ci-scripts.git && cd ci-scripts && git show --oneline -s
        name: Clone ci-scripts

jobs:
  build:
    executor: common-executor
    steps:
    - checkout
    - run: make install_deps
    - run: make test
    - persist_to_workspace:
        root: ~/go/src/github.com/Clever
        paths: "."
    - run: if [ "${CIRCLE_BRANCH}" == "master" ]; then cat ./swagger.yml | grep "^  version:" | cut -d":" -f2 | tr -d " " > ./VERSION; fi;
    - run: if [ "${CIRCLE_BRANCH}" == "master" ]; then $HOME/ci-scripts/circleci/github-release $GH_RELEASE_TOKEN; fi;


Add code to create release. Note: V was set to 1.8.0, latest release was 1.7.3.
Add code to create release. Note: V was set to 1.8.0, latest release was 1.7.3.
