From 18ba236a21ac8bd55cb41125c05b00c21bf724d7 Mon Sep 17 00:00:00 2001
From: Andrew Lisowski <lisowski54@gmail.com>
Date: Tue, 5 Mar 2019 16:41:11 -0800
Subject: [PATCH] add circle

---
 .circleci/config.yml | 88 ++++++++++++++++++++++++++++++++++++++++++++
 package.json         |  3 +-
 2 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 .circleci/config.yml

diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 00000000..3d227a8e
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,88 @@
+version: 2
+
+defaults: &defaults
+  working_directory: ~/storybook-dark-mode
+  docker:
+    - image: circleci/node:latest-browsers
+
+jobs:
+  install:
+    <<: *defaults
+    steps:
+      - checkout
+      - restore_cache:
+          keys:
+            # Find a cache corresponding to this specific package.json checksum
+            # when this file is changed, this key will fail
+            - storybook-dark-mode-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ checksum ".circleci/config.yml" }}
+            - storybook-dark-mode-{{ .Branch }}-{{ checksum "yarn.lock" }}
+            - storybook-dark-mode-{{ .Branch }}
+            # Find the most recent cache used from any branch
+            - storybook-dark-mode-master
+            - storybook-dark-mode-
+      - run:
+          name: Install Dependencies
+          command: yarn install --frozen-lockfile
+      - save_cache:
+          key: storybook-dark-mode-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ checksum ".circleci/config.yml" }}
+          paths:
+            - node_modules
+            - ~/.cache/yarn
+      - persist_to_workspace:
+          root: .
+          paths:
+            - .
+
+  lint:
+    <<: *defaults
+    steps:
+      - attach_workspace:
+          at: ~/storybook-dark-mode
+      - run:
+          name: Lint
+          command: yarn lint
+
+  build:
+    <<: *defaults
+    steps:
+      - attach_workspace:
+          at: ~/storybook-dark-mode
+      - run:
+          name: Build
+          command: yarn build
+      - persist_to_workspace:
+          root: .
+          paths:
+            - .
+
+  release:
+    <<: *defaults
+    steps:
+      - attach_workspace:
+          at: ~/storybook-dark-mode
+      - run:
+          name: Release
+          command: yarn release
+
+workflows:
+  version: 2
+  build_and_test:
+    jobs:
+      - install
+
+      - lint:
+          requires:
+            - install
+
+      - build:
+          requires:
+            - install
+
+      - release:
+          requires:
+            - lint
+            - build
+          filters:
+            branches:
+              only:
+                - master
diff --git a/package.json b/package.json
index 64ff489c..b8eb21a4 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,8 @@
   },
   "scripts": {
     "lint": "eslint --ext .ts --ext .tsx src/**",
-    "build": "tsc"
+    "build": "tsc",
+    "release": "auto shipit"
   },
   "peerDependencies": {
     "react": "*"