From 31f1dce033295563b5c9db7794a75d557de87523 Mon Sep 17 00:00:00 2001 From: abouhanifa Date: Sun, 28 Mar 2021 15:14:18 +0200 Subject: [PATCH] :wrench: add deploy command and script :hammer: --- .circleci/config.yml | 26 ++++++++++++++++++++++++-- package.json | 3 ++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index af52ccc..24f390e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,7 +61,23 @@ jobs: - node_modules key: v1-dependencies-{{ checksum "package.json" }} - run: yarn run build - + deploy_to_netlify: + docker: + - image: node:10.18.0 + working_directory: ~/repo + steps: + - checkout + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + - v1-dependencies- + - run: yarn install + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ checksum "package.json" }} + - run: yarn global add netlify-cli + - run: yarn run build && yarn run netlify:deploy workflows: project_workflows: jobs: @@ -69,4 +85,10 @@ workflows: - check_format - build: requires: - - test \ No newline at end of file + - test + - deploy_to_netlify: + requires: + - build + filters: + branches: + only: main \ No newline at end of file diff --git a/package.json b/package.json index 822d1ee..cc47016 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "build": "react-scripts build", "test": "react-scripts test", "format:write": "prettier --write \"**/*.{js,vue,json,ts,tsx,md,yml,html}\"", - "format:check": "prettier --list-different \"**/*.{js,vue,json,ts,tsx,md,yml,html}\"" + "format:check": "prettier --list-different \"**/*.{js,vue,json,ts,tsx,md,yml,html}\"", + "netlify:deploy": "netlify deploy --dir=./build -p -m \"$(git log -1 --pretty=%B)\"" }, "eslintConfig": { "extends": [