version: 2

defaults: &defaults
  working_directory: ~/workspace
  docker:
    - image: circleci/openjdk:8

jobs:
  build:
    <<: *defaults
    steps:
      - checkout
      - restore_cache:
          key: retz-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
      - run: ./gradlew -i clean build
      - save_cache:
           key: retz-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
           paths:
             - "~/.gradle"
      - persist_to_workspace:
          root: ~/workspace
          paths:
            - .

  deploy:
    <<: *defaults
    steps:
      - attach_workspace:
          at: ~/workspace
      - restore_cache:
          key: retz-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
      - run: ./gradlew -i publish

workflows:
  version: 2
  build_and_deploy:
    jobs:
      - build
          filters:
            tags:
              only: /.*/
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master
            tags:
              only: /.*/

version: 2

defaults: &defaults
  working_directory: ~/workspace
  docker:
    - image: circleci/openjdk:8

jobs:
  build:
    <<: *defaults
    steps:
      - checkout
      - restore_cache:
          key: retz-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
      - run: ./gradlew -i clean build
      - save_cache:
           key: retz-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
           paths:
             - "~/.gradle"
      - persist_to_workspace:
          root: ~/workspace
          paths:
            - .

  deploy:
    <<: *defaults
    steps:
      - attach_workspace:
          at: ~/workspace
      - restore_cache:
          key: retz-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
      - run: ./gradlew -i publish

workflows:
  version: 2
  build_and_deploy:
    jobs:
      - build:
          filters:
            tags:
              only: /.*/
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master
            tags:
              only: /.*/

Fix CircleCI confiuration file syntax
Fix CircleCI confiuration file syntax
