This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from thibault-deriv/clean_ci
Fix deployment and clean CircleCI config
- Loading branch information
Showing
1 changed file
with
20 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,24 +3,6 @@ orbs: | |
k8s: circleci/[email protected] | ||
slack: circleci/[email protected] | ||
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 [email protected] | ||
git config user.email "[email protected]" | ||
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 | ||
|