version: 2
jobs:
  test:
    docker:
      - image: circleci/golang:latest
    steps:
      - checkout
      - run: go test -v ./
      - run: go test -v ./cmd/jid
  release:
    docker:
      - image: circleci/golang:latest
    steps:
      - checkout
      - run: 
          name: build jid using goreleaser
          command: curl -sL https://git.io/goreleaser | bash
workflows:
  version: 2
  test_and_release:
    jobs:
      - test
      - release:
          requires:
            - test
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /v[0-9]+(\.[0-9]+)*(-.*)*/

version: 2
jobs:
  test:
    docker:
      - image: circleci/golang:latest
    steps:
      - checkout
      - run: go test -v ./
      - run: go test -v ./cmd/jid
  release:
    docker:
      - image: circleci/golang:latest
    steps:
      - checkout
      - run: 
          name: build jid using goreleaser
          command: curl -sL https://git.io/goreleaser | bash
workflows:
  version: 2
  test_and_release:
    jobs:
      - test:
          filters:
            tags:
              only: /v[0-9]+(\.[0-9]+)*(-.*)*/
      - release:
          requires:
            - test
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /v[0-9]+(\.[0-9]+)*(-.*)*/

Add CircleCI filter: run test when push version tags
Add CircleCI filter:  run test when push version tags
