forked from Shyam-Chen/Express-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
74 lines (61 loc) · 2.07 KB
/
circle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
version: 2
jobs:
build-test-deploy:
docker:
- image: circleci/node:12
working_directory: ~/Express-Starter
steps:
- checkout
- setup_remote_docker
- run:
name: Combat Preparation
command: |
docker-compose up -d app
docker-compose exec -d app yarn start
- run:
name: Compile Code
command: docker-compose exec app yarn build
- run:
name: Code Quality
command: docker-compose exec app yarn lint
- run:
name: Code Specification
command: |
docker-compose exec app yarn unit
docker-compose exec app yarn _codecov --token=$CODECOV_TOKEN
- run:
name: E2E Specification
command: |
docker-compose exec app sh -c "sleep 10"
docker-compose exec app yarn e2e
- run:
name: Deploy Application
command: |
case "${CIRCLE_BRANCH}" in
"develop"|*"release"*|"master")
case "$CIRCLE_BRANCH" in
"develop")
APP_NAME=backend-starter-kit
DEPLOYMENT_ENVIRONMENT=dev
;;
*"release"*)
APP_NAME=backend-starter-kit
DEPLOYMENT_ENVIRONMENT=stage
;;
"master")
APP_NAME=backend-starter-kit
DEPLOYMENT_ENVIRONMENT=prod
;;
esac
echo "${HEROKU_TOKEN}" | docker login -u "${HEROKU_USERNAME}" --password-stdin registry.heroku.com
docker build -f ./tools/$DEPLOYMENT_ENVIRONMENT.Dockerfile -t $APP_NAME .
docker tag $APP_NAME registry.heroku.com/$APP_NAME/web
docker push registry.heroku.com/$APP_NAME/web
docker-compose exec -e HEROKU_API_KEY=$HEROKU_TOKEN app yarn _heroku container:release web -a $APP_NAME
;;
esac
workflows:
version: 2
workflow:
jobs:
- build-test-deploy