From de82c677dd5c8741ecbc9698b2ea89d5811a2d6d Mon Sep 17 00:00:00 2001 From: samuraikun Date: Fri, 28 Sep 2018 11:56:08 +0900 Subject: [PATCH 1/5] add config.yml for circleci. --- .circleci/config.yml | 37 +++++++++++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..983dc2c --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,37 @@ +# Javascript Node CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-javascript/ for more details +# +version: 2 +jobs: + build: + docker: + # specify the version you desire here + - image: circleci/node:7.10 + + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + # - image: circleci/mongo:3.4.4 + + working_directory: ~/repo + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: npm install + + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ checksum "package.json" }} + + # run tests! + - run: npm run circleci \ No newline at end of file diff --git a/package.json b/package.json index 6cf0369..d6f0506 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "circleci": "echo Hello CircleCI." } } From e24b9cd300baad7193b805053dfb444950b6ad10 Mon Sep 17 00:00:00 2001 From: samuraikun Date: Fri, 28 Sep 2018 12:06:24 +0900 Subject: [PATCH 2/5] change node verision --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 983dc2c..dc2d15a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: build: docker: # specify the version you desire here - - image: circleci/node:7.10 + - image: circleci/node:8 # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images From d45a2d1e9603425d9abcf7d8d36ddca944031d40 Mon Sep 17 00:00:00 2001 From: samuraikun Date: Fri, 28 Sep 2018 12:36:27 +0900 Subject: [PATCH 3/5] add command that deploy hosting when git push --- .circleci/config.yml | 14 ++++++++++---- package.json | 3 +-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dc2d15a..a47c9e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,6 @@ version: 2 jobs: build: docker: - # specify the version you desire here - image: circleci/node:8 # Specify service dependencies here if necessary @@ -14,7 +13,7 @@ jobs: # documented at https://circleci.com/docs/2.0/circleci-images/ # - image: circleci/mongo:3.4.4 - working_directory: ~/repo + working_directory: ~/firebase-youtube-clone steps: - checkout @@ -27,11 +26,18 @@ jobs: - v1-dependencies- - run: npm install + - run: + name: 'Install Dependecies' + command: npm install --save-dev firebase-tools create-react-app - save_cache: paths: - node_modules key: v1-dependencies-{{ checksum "package.json" }} - # run tests! - - run: npm run circleci \ No newline at end of file + - run: + name: 'Build Client Code' + command: npm run build + - run: + name: 'Deploy to Hosting' + command: firebase deploy --only hosting --project "$FIREBASE_PROJECT_ID" --token "$FIREBASE_TOKEN" \ No newline at end of file diff --git a/package.json b/package.json index d6f0506..6cf0369 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", - "eject": "react-scripts eject", - "circleci": "echo Hello CircleCI." + "eject": "react-scripts eject" } } From 28d81f9e24f5c98850e1cee8a565cee6a7ae06e5 Mon Sep 17 00:00:00 2001 From: samuraikun Date: Fri, 28 Sep 2018 13:03:43 +0900 Subject: [PATCH 4/5] create symlink firebase command --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a47c9e3..6910d8e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,7 @@ jobs: - run: npm install - run: name: 'Install Dependecies' - command: npm install --save-dev firebase-tools create-react-app + command: npm install --save-dev firebase-tools - save_cache: paths: @@ -40,4 +40,5 @@ jobs: command: npm run build - run: name: 'Deploy to Hosting' - command: firebase deploy --only hosting --project "$FIREBASE_PROJECT_ID" --token "$FIREBASE_TOKEN" \ No newline at end of file + command: ln -s ./node_modules/.bin/firebase . && \ + ./firebase deploy --only hosting --project "$FIREBASE_PROJECT_ID" --token "$FIREBASE_TOKEN" \ No newline at end of file From f96059251d00e18da5d48931091954fd3d2ac690 Mon Sep 17 00:00:00 2001 From: samuraikun Date: Fri, 28 Sep 2018 13:13:34 +0900 Subject: [PATCH 5/5] fix path --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6910d8e..3e8fb6f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,5 +40,6 @@ jobs: command: npm run build - run: name: 'Deploy to Hosting' - command: ln -s ./node_modules/.bin/firebase . && \ - ./firebase deploy --only hosting --project "$FIREBASE_PROJECT_ID" --token "$FIREBASE_TOKEN" \ No newline at end of file + command: >- + ln -s ./node_modules/firebase-tools/bin/firebase . && + ./firebase deploy --only hosting --project "$FIREBASE_PROJECT_ID" --token "$FIREBASE_TOKEN" \ No newline at end of file