version: 2
jobs:
  test:
    working_directory: ~/js-sdk
    docker:
      - image: circleci/node:10.5-stretch-browsers
    steps:
      - checkout
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn install
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ checksum "yarn.lock" }}
          paths:
            - ~/.cache/yarn
      - run:
          name: Test
          command: yarn test
  publish:
    working_directory: ~/js-sdk
    docker:
      - image: circleci/node:10.5-stretch-browsers
    steps:
      - checkout
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn install
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ checksum "yarn.lock" }}
          paths:
            - ~/.cache/yarn
      - run:
          name: Authenticate with registry
          command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/js-sdk/.npmrc
      - run:
          name: Compile Source
          command: yarn run compile
      - run:
          name: Publish Package
          command: npm publish
workflows:
  version: 2
  test_and_publish:
    jobs:
      - test
      - publish:
          requires:
            - test
          filters:
            branches:
              only:
                - master

version: 2
jobs:
  test:
    working_directory: ~/js-sdk
    docker:
      - image: circleci/node:10.12.0
    steps:
      - checkout
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn install
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ checksum "yarn.lock" }}
          paths:
            - ~/.cache/yarn
      - run:
          name: Test
          command: yarn test
  publish:
    working_directory: ~/js-sdk
    docker:
      - image: circleci/node:10.12.0
    steps:
      - checkout
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn install
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ checksum "yarn.lock" }}
          paths:
            - ~/.cache/yarn
      - run:
          name: Authenticate with registry
          command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/js-sdk/.npmrc
      - run:
          name: Compile Source
          command: yarn run compile
      - run:
          name: Publish Package
          command: npm publish
workflows:
  version: 2
  test_and_publish:
    jobs:
      - test
      - publish:
          requires:
            - test
          filters:
            branches:
              only:
                - master

Update node docker image in circleci
Update node docker image in circleci
