From 9ea53fa365c9b781eb385ef937268599102556b9 Mon Sep 17 00:00:00 2001 From: boatnoodle Date: Mon, 17 Feb 2020 20:34:34 +0700 Subject: [PATCH 1/5] :rocket: Deploy netlify via circle ci --- .circleci/config.yml | 26 ++++++++++---------------- .gitignore | 4 +++- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6021a421..62c2f517 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,27 +23,21 @@ jobs: - ~/.cache/yarn deploy-prod: - machine: true - # docker: - # - image: circleci/node:12.14.0 + docker: + - image: circleci/node:12.14.0 + + working_directory: ~/repo + steps: - checkout + - run: - name: Setup VirtualEnv - command: | - echo 'export TAG=0.1.${CIRCLE_BUILD_NUM}' >> $BASH_ENV - echo 'export IMAGE_NAME=${IMAGE_NAME}' >> $BASH_ENV + name: install netlify cli + command: sudo npm install netlify-cli -g - run: - name: 'Build and push Docker image' - command: | - docker build -t $IMAGE_NAME:$TAG . - echo $HUB_PASSWORD | docker login $HOST_REGISTRY -u $HUB_USERNAME -p $HUB_PASSWORD - docker push $IMAGE_NAME:$TAG + name: deploy site to netlify + command: netlify deploy --dir=/home/circleci/project/public -p - - run: - name: 'Deploy app to Digital Ocean Server via Docker' - command: | - ssh -i ~/.ssh/id_rsa_circleci $DROPLET_USER@$DROPLET_IP "/bin/bash ./deploy_project.sh $IMAGE_NAME:$TAG" workflows: version: 2 build-and-deploy: diff --git a/.gitignore b/.gitignore index 42efce6e..2fef2059 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ sketch #env .env -# End of https://www.gitignore.io/api/react \ No newline at end of file +# End of https://www.gitignore.io/api/react +# Local Netlify folder +.netlify \ No newline at end of file From b8a27fc479718c7f1824219d8cddba64c166640c Mon Sep 17 00:00:00 2001 From: boatnoodle Date: Mon, 17 Feb 2020 20:39:05 +0700 Subject: [PATCH 2/5] :rocket: Fix build step for netlify --- .circleci/config.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 62c2f517..1c590940 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,9 +3,6 @@ jobs: build: docker: - image: circleci/node:12.14.0 - - working_directory: ~/repo - steps: - checkout @@ -21,15 +18,22 @@ jobs: key: yarn-packages-{{ checksum "yarn.lock" }} paths: - ~/.cache/yarn + - run: + name: Build Public + command: npm run build + - persist_to_workspace: + root: /home/circleci/project + paths: + - public deploy-prod: docker: - image: circleci/node:12.14.0 - working_directory: ~/repo - steps: - checkout + - attach_workspace: + at: /home/circleci/project/ - run: name: install netlify cli From cadde7179a7f21829c7d0c7e178d5d4e800821c2 Mon Sep 17 00:00:00 2001 From: boatnoodle Date: Mon, 17 Feb 2020 20:58:11 +0700 Subject: [PATCH 3/5] :rocket: Update step deploy netlify --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1c590940..2db9eda7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,8 +39,8 @@ jobs: name: install netlify cli command: sudo npm install netlify-cli -g - run: - name: deploy site to netlify - command: netlify deploy --dir=/home/circleci/project/public -p + name: Netlify Deploy + command: netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN --dir=public workflows: version: 2 From fefdde13827c722b3892bfe319d87bc6c22c1c01 Mon Sep 17 00:00:00 2001 From: boatnoodle Date: Mon, 17 Feb 2020 21:02:09 +0700 Subject: [PATCH 4/5] :rocket: Update environment auth netlify --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2db9eda7..356ba579 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,7 +40,7 @@ jobs: command: sudo npm install netlify-cli -g - run: name: Netlify Deploy - command: netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN --dir=public + command: netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_AUTH_TOKEN --dir=public workflows: version: 2 From 641e0908304693338bd8d147ac941d68a3041334 Mon Sep 17 00:00:00 2001 From: boatnoodle Date: Mon, 17 Feb 2020 21:06:55 +0700 Subject: [PATCH 5/5] :rocket: Test deploy --- pages/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/index.tsx b/pages/index.tsx index 1f627dab..3b8172a9 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -17,6 +17,7 @@ const Index: FunctionComponent = () => { const { data, loading, error } = useQuery(USERS); return ( +

Landing page

);