twenty/.circleci/config.yml
2022-12-28 12:01:09 +01:00

67 lines
1.9 KiB
YAML

version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@8.2.1
aws-ecs: circleci/aws-ecs@03.2.0
slack: circleci/slack@4.12.0
node: circleci/node@5.0.3
jobs:
tests:
executor: node/default
steps:
- checkout
- run:
command: cd front && npm install
name: install node dependencies
- run:
command: cd front && npm run test
name: tests
workflows:
build-and-deploy:
jobs:
- tests
- aws-ecr/build-and-push-image:
filters:
branches:
only: main
requires:
- tests
dockerfile: Dockerfile
registry-id: AWS_ACCOUNT_ID
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
repo: $AWS_ECR_REPO
tag: $CIRCLE_SHA1
- aws-ecs/deploy-service-update:
name: deploy-canary
requires:
- aws-ecr/build-and-push-image
family: $AWS_ECS_CONTAINER_NAME_CANARY
cluster: $AWS_ECS_CLUSTER
container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_CANARY,tag=${CIRCLE_SHA1}"
- slack/on-hold:
name: slack-notification
context: slack-secrets
requires:
- deploy-canary
- hold:
type: approval
requires:
- slack-notification
- aws-ecs/deploy-service-update:
name: deploy-prod
requires:
- hold
family: $AWS_ECS_CONTAINER_NAME_DEFAULT
cluster: $AWS_ECS_CLUSTER
container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_DEFAULT,tag=${CIRCLE_SHA1}"
post-steps:
- slack/notify:
event: pass
template: basic_success_1
- slack/notify:
event: fail
template: basic_fail_1