diff --git a/.circleci/config.yml b/.circleci/config.yml index 23e04b0..2bbe487 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: @@ -43,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: @@ -125,23 +92,25 @@ 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: 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 + - versioning: + target_branch: "staging" - persist_to_workspace: root: lib paths: @@ -150,23 +119,15 @@ jobs: docker: - image: circleci/node:8.10.0-stretch steps: - - git_checkout_from_cache + - checkout - npm_install - build + - versioning: + target_branch: "production" - persist_to_workspace: root: lib paths: - . - - deploy: - target_branch: "production" - - notify_slack - release_aws_production: - docker: - - image: circleci/node:9.9.0-stretch - steps: - - git_checkout_from_cache - - npm_install - - build - docker_build_push - k8s_deploy - notify_slack @@ -192,24 +153,12 @@ workflows: filters: branches: ignore: /^master$/ - release: + release_staging: jobs: - release_staging: filters: branches: only: /^master$/ - - release_production: - filters: - branches: - ignore: /.*/ - tags: - only: /^production.*/ - - release_aws_production: - filters: - branches: - ignore: /.*/ - tags: - only: /^production.*/ context: binary-frontend-artifact-upload - publish_cloudflare_staging: requires: @@ -218,6 +167,15 @@ workflows: branches: only: /^master$/ context: binary-frontend-artifact-upload + release_production: + jobs: + - release_production: + filters: + branches: + ignore: /.*/ + tags: + only: /^production.*/ + context: binary-frontend-artifact-upload - publish_cloudflare_production: requires: - release_production