forked from velopert/velog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
119 lines (119 loc) · 3.4 KB
/
config.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build-frontend:
docker:
# specify the version you desire here
- image: circleci/node:8.12.0
environment:
CI: false
working_directory: ~/repo/velog-frontend
steps:
- checkout:
path: ~/repo
- attach_workspace:
at: ~/repo
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: yarn build
- run: mkdir -p ../velog-ssr/dist/ssr
- run: yarn build:server
# - store_artifacts:
# path: ~/repo/velog-frontend/build
- persist_to_workspace:
root: ~/repo
paths:
- velog-frontend/build
- velog-ssr/src/ssr/render.js
- velog-ssr/asset-manifest.json
deploy-frontend:
docker:
- image: circleci/python:2.7-jessie
working_directory: ~/repo/velog-frontend
steps:
- checkout:
path: ~/repo
- attach_workspace:
at: ~/repo
- run: sudo pip install awscli
- run: aws s3 cp ./build s3://cdn.velog.io/ --recursive
- run: aws cloudfront create-invalidation --distribution-id E1M9D68QZ0CD1F --paths / /index.html /error.html /service-worker.js /manifest.json /favicon.ico
deploy-ssr:
docker:
- image: circleci/node:8.12.0
environment:
CI: false
working_directory: ~/repo/velog-ssr
steps:
- checkout:
path: ~/repo
- attach_workspace:
at: ~/repo
- restore_cache:
keys:
- v1-ssr-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-ssr-dependencies-
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-ssr-dependencies-{{ checksum "package.json" }}
- run: mkdir dist
- run: yarn deploy
- run: curl https://api.velog.io/internal/flush?key=$INTERNAL_KEY
deploy-backend:
docker:
- image: circleci/node:8.12.0
working_directory: ~/repo/velog-backend
steps:
- checkout:
path: ~/repo
- attach_workspace:
at: ~/repo
- restore_cache:
keys:
- v1-backend-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-backend-dependencies-
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-ssr-dependencies-{{ checksum "package.json" }}
- run: yarn deploy
workflows:
version: 2
build-and-deploy:
jobs:
- build-frontend:
filters:
branches:
only: master
- deploy-frontend:
filters:
branches:
only: master
requires:
- build-frontend
- deploy-ssr:
filters:
branches:
only: master
requires:
- deploy-frontend
- deploy-backend:
filters:
branches:
only: master