Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Clean CI #7331

Merged
merged 2 commits into from
Feb 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 12 additions & 57 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +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:
keys:
- source-v1-{{ .Branch }}-{{ .Revision }}
- source-v1-{{ .Branch }}-
- source-v1-
- run:
name: Fetch git tags
command: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== ' >> ~/.ssh/known_hosts
# Fetch tags if git cache is present
if [ -e /home/circleci/project/.git ]
then
git fetch origin --tags
fi
- checkout
- run:
name: Compress git objects
command: git gc
- save_cache:
key: source-v1-{{ .Branch }}-{{ .Revision }}
paths:
- ".git"
npm_install:
description: "npm install and save cache"
steps:
Expand Down Expand Up @@ -60,15 +33,12 @@ commands:
- run:
name: Building dist for << parameters.target >>
command: node_modules/grunt/bin/grunt releaseci --<< parameters.target >>
deploy:
description: "Deploy to static branches"
versioning:
description: "Add version to build"
parameters:
target_branch:
type: string
steps:
- checkout
- attach_workspace:
at: dist
- run:
name: Tag build
command: echo "<< parameters.target_branch >> $(date -u +'%Y-%m-%dT%H:%M:%SZ')" > dist/version
Expand Down Expand Up @@ -141,32 +111,34 @@ commands:
name: "Publish to cloudflare pages (production)"
command: |
cd dist
npx wrangler pages publish . --project-name=binary-static-pages --branch=main
npx wrangler pages publish . --project-name=binary-static-pages --branch=main-test
echo "New website - http://cf-pages-binary-static.binary.com"
jobs:
test:
docker:
- image: circleci/node:14-stretch
steps:
- git_checkout_from_cache
- checkout
- npm_install
- test
release_staging:
docker:
- image: circleci/node:14-stretch
steps:
- git_checkout_from_cache
- checkout
- npm_install
- test
- build:
target: 'staging'
- build:
target: 'translations'
- versioning:
target_branch: "staging"
- persist_to_workspace:
root: dist
paths:
- .
- deploy:
- versioning:
target_branch: "staging"
- docker_build_push
- k8s_deploy
Expand All @@ -175,42 +147,32 @@ jobs:
docker:
- image: circleci/node:14-stretch
steps:
- git_checkout_from_cache
- checkout
- npm_install
- test
- build:
target: 'production'
- versioning:
target_branch: "production"
- persist_to_workspace:
root: dist
paths:
- .
- deploy:
target_branch: "production"
- notify_slack
release_aws_production:
docker:
- image: circleci/node:14-stretch
steps:
- git_checkout_from_cache
- npm_install
- test
- build:
target: 'production'
- docker_build_push:
docker_latest_image_tag: latest
docker_image_tag: ${CIRCLE_TAG}
- k8s_deploy:
k8s_svc_name: "production-binary-com"
k8s_namespace: "www-binary-com-production"
k8s_version: ${CIRCLE_TAG}
- notify_slack
publish_cloudflare_staging:
docker:
- image: circleci/node:16.13.1-stretch
steps:
- attach_workspace:
at: dist
- publish_to_pages_staging

publish_cloudflare_production:
docker:
- image: circleci/node:16.13.1-stretch
Expand Down Expand Up @@ -247,13 +209,6 @@ workflows:
tags:
only: /^production.*/
context: binary-frontend-artifact-upload
- release_aws_production:
filters:
branches:
ignore: /.*/
tags:
only: /^production.*/
context: binary-frontend-artifact-upload
- publish_cloudflare_production:
requires:
- release_production
Expand Down