version: 2.1 jobs: build: docker: - image: circleci/node:dubnium-browsers steps: - checkout - restore_cache: keys: - yarn-packages-{{ checksum "yarn.lock" }}-{{ .Environment.CACHE_VERSION }} - yarn-packages - run: yarn global add node-gyp && yarn install - save_cache: key: yarn-packages-{{ checksum "yarn.lock" }}-{{ .Environment.CACHE_VERSION }} paths: - node_modules test: docker: - image: circleci/node:dubnium-browsers steps: - checkout - restore_cache: keys: - yarn-packages-{{ checksum "yarn.lock" }}-{{ .Environment.CACHE_VERSION }} - run: command: yarn test prod: docker: - image: circleci/node:dubnium-browsers steps: - checkout - restore_cache: keys: - yarn-packages-{{ checksum "yarn.lock" }}-{{ .Environment.CACHE_VERSION }} - run: command : yarn run build - run: command: | cp dist/ /tmp/dist -r - store_artifacts: path: /tmp/dist - persist_to_workspace: root: /tmp paths: - dist deploy: docker: - image: circleci/node:dubnium-browsers working_directory: ~/deploy-netlfify steps: - attach_workspace: at: /tmp - run: command: | sudo npm install -g --silent netlify-cli netlify deploy --prod --auth $NETLIFY_TOKEN --dir=/tmp/dist --site $NETLIFY_SITE_ID workflows: build_and_test: jobs: - build - prod: requires: - build - deploy: requires: - prod