From d700b12208e138896459cbee2e0f03c50755bad1 Mon Sep 17 00:00:00 2001 From: Thibault DUPONCHELLE Date: Fri, 28 Apr 2023 15:11:27 +0200 Subject: [PATCH 1/5] Simplify checkout --- .circleci/config.yml | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 23e04b0..4fbd2ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,24 +3,6 @@ orbs: k8s: circleci/kubernetes@0.7.0 slack: circleci/slack@3.4.2 commands: - git_checkout_from_cache: - description: "Git checkout and save cache" - steps: - - restore_cache: - name: Git restore cache - keys: - - source-v1-{{ .Branch }}-{{ .Revision }} - - source-v1-{{ .Branch }}- - - source-v1- - - checkout - - run: - name: Compress git objects - command: git gc - - save_cache: - name: Git save cache - key: source-v1-{{ .Branch }}-{{ .Revision }} - paths: - - ".git" npm_install: description: "Install npm modules" steps: @@ -132,14 +114,14 @@ jobs: docker: - image: circleci/node:8.10.0-stretch steps: - - git_checkout_from_cache + - checkout - npm_install - build release_staging: docker: - image: circleci/node:8.10.0-stretch steps: - - git_checkout_from_cache + - checkout - npm_install - build - persist_to_workspace: @@ -150,7 +132,7 @@ jobs: docker: - image: circleci/node:8.10.0-stretch steps: - - git_checkout_from_cache + - checkout - npm_install - build - persist_to_workspace: @@ -164,7 +146,7 @@ jobs: docker: - image: circleci/node:9.9.0-stretch steps: - - git_checkout_from_cache + - checkout - npm_install - build - docker_build_push From 043ee6893cfeebbceabc72c0379f653c29778363 Mon Sep 17 00:00:00 2001 From: Thibault DUPONCHELLE Date: Fri, 28 Apr 2023 15:13:40 +0200 Subject: [PATCH 2/5] Do not deploy to GH pages. Rename deploy to versioning. Add versioning to staging --- .circleci/config.yml | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4fbd2ec..08517fe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,30 +25,15 @@ commands: - run: name: "yarn build" command: yarn build - deploy: - description: "Deploy to static branches" + versioning: + description: "Add version to build" parameters: target_branch: type: string steps: - - checkout - - attach_workspace: - at: lib - run: name: Tag build command: echo "<< parameters.target_branch >> $(date -u +'%Y-%m-%dT%H:%M:%SZ')" > lib/version - - run: - name: Install and configure dependencies - command: | - sudo npm install -g gh-pages@2.0.1 - git config user.email "ci-build@binary.com" - git config user.name "ci-build" - - add_ssh_keys: - fingerprints: - - "01:67:4a:6d:26:9c:70:c4:1a:60:91:88:d9:dd:f0:83" - - run: - name: Deploy docs to gh-pages branch - command: gh-pages -d lib --branch << parameters.target_branch >> --message '[skip ci]' docker_build_push: description: "Build and Push image to docker hub" steps: @@ -124,6 +109,8 @@ jobs: - checkout - npm_install - build + - versioning: + target_branch: "staging" - persist_to_workspace: root: lib paths: @@ -135,12 +122,12 @@ jobs: - checkout - npm_install - build + - versioning: + target_branch: "production" - persist_to_workspace: root: lib paths: - . - - deploy: - target_branch: "production" - notify_slack release_aws_production: docker: From 3f380fabba50572154f97e6f2201b822387430b5 Mon Sep 17 00:00:00 2001 From: Thibault DUPONCHELLE Date: Fri, 28 Apr 2023 15:15:06 +0200 Subject: [PATCH 3/5] Beautify CircleCI dashboard --- .circleci/config.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 08517fe..007f00e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -161,18 +161,21 @@ workflows: filters: branches: ignore: /^master$/ - release: + release_staging: jobs: - release_staging: filters: branches: only: /^master$/ - - release_production: + - publish_cloudflare_staging: + requires: + - release_staging filters: branches: - ignore: /.*/ - tags: - only: /^production.*/ + only: /^master$/ + context: binary-frontend-artifact-upload + release_production: + jobs: - release_aws_production: filters: branches: @@ -180,13 +183,12 @@ workflows: tags: only: /^production.*/ context: binary-frontend-artifact-upload - - publish_cloudflare_staging: - requires: - - release_staging + - release_production: filters: branches: - only: /^master$/ - context: binary-frontend-artifact-upload + ignore: /.*/ + tags: + only: /^production.*/ - publish_cloudflare_production: requires: - release_production From 24647844ffb75b70a01f08ec74ae13d8306bd955 Mon Sep 17 00:00:00 2001 From: Thibault DUPONCHELLE Date: Fri, 28 Apr 2023 15:18:47 +0200 Subject: [PATCH 4/5] Add context to staging --- .circleci/config.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 007f00e..72e5c47 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,14 +128,6 @@ jobs: root: lib paths: - . - - notify_slack - release_aws_production: - docker: - - image: circleci/node:9.9.0-stretch - steps: - - checkout - - npm_install - - build - docker_build_push - k8s_deploy - notify_slack @@ -167,6 +159,7 @@ workflows: filters: branches: only: /^master$/ + context: binary-frontend-artifact-upload - publish_cloudflare_staging: requires: - release_staging @@ -176,19 +169,13 @@ workflows: context: binary-frontend-artifact-upload release_production: jobs: - - release_aws_production: - filters: - branches: - ignore: /.*/ - tags: - only: /^production.*/ - context: binary-frontend-artifact-upload - release_production: filters: branches: ignore: /.*/ tags: only: /^production.*/ + context: binary-frontend-artifact-upload - publish_cloudflare_production: requires: - release_production From 39bf6ed35c2081c2c642ab1d79beada93fe4f1a9 Mon Sep 17 00:00:00 2001 From: Thibault DUPONCHELLE Date: Fri, 28 Apr 2023 15:21:10 +0200 Subject: [PATCH 5/5] Do not publish to production --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 72e5c47..2bbe487 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,7 +92,7 @@ commands: name: "Publish to cloudflare pages (production)" command: | cd lib - npx wrangler pages publish . --project-name=binary-live-api-pages --branch=main + npx wrangler pages publish . --project-name=binary-live-api-pages --branch=maintest echo "New website - http://cf-pages-binary-live-api.binary.com" jobs: build: