3
3
gcp-cli :
circleci/[email protected]
4
4
5
5
jobs :
6
+ checkout-to-workspace :
7
+ docker :
8
+ - image : circleci/python:3.8-buster-node
9
+ steps :
10
+ - checkout
11
+ - persist_to_workspace :
12
+ root : .
13
+ paths :
14
+ - .
6
15
build-flask :
7
16
docker :
8
17
- image : circleci/python:3.8-buster
9
18
working_directory : ~/flask
10
19
steps :
11
- - checkout
20
+ - attach_workspace :
21
+ at : ~/
12
22
# Restore cached dependencies
13
23
- restore_cache :
14
24
key : flask-deps-{{ checksum "requirements.txt" }}
34
44
- image : circleci/python:3.8-buster-node
35
45
working_directory : ~/react
36
46
steps :
37
- - run :
38
- name : Clone React Repo
39
- command : |
40
- cd ..
41
- git clone --branch master https://github.com/boxwise/boxwise-react.git react
47
+ - attach_workspace :
48
+ at : ~/
42
49
- run :
43
50
name : Generate .env File
44
51
command : |
50
57
REACT_APP_LOGOUT_URL=${REACT_APP_LOGOUT_URL}
51
58
REACT_APP_GRAPHQL_SERVER=${REACT_APP_GRAPHQL_SERVER}" > .env
52
59
- run :
53
- name : Set hompage in package.json
60
+ name : Set homepage in package.json
54
61
command : |
55
62
sed -i 's|"homepage": "http://localhost:3000/"|"homepage": "https://'$URL'/mobile"|' package.json
56
63
# following https://circleci.com/docs/2.0/yarn/
85
92
steps :
86
93
# Attach workspace from build
87
94
- attach_workspace :
88
- at : .
95
+ at : ~/
89
96
# - restore_cache:
90
97
# key: flask-dev-deps-{{ checksum "requirements-dev.txt" }}
91
98
- run :
@@ -122,7 +129,7 @@ jobs:
122
129
steps :
123
130
# Attach workspace from build
124
131
- attach_workspace :
125
- at : .
132
+ at : ~/
126
133
# install gcloud orb
127
134
- gcp-cli/install
128
135
- run :
@@ -159,74 +166,19 @@ jobs:
159
166
- slack/notify-on-failure :
160
167
only_for_branches : master,production
161
168
162
-
163
169
workflows :
164
170
build-and-deploy :
165
171
jobs :
166
- - build-flask
167
-
168
- - test-flask :
169
- requires :
170
- - build-flask
171
-
172
- - build-react :
173
- name : build-react-for-staging
174
- context : STAGING
175
- filters :
176
- branches :
177
- only : master
178
-
179
- # deploy to staging
180
- - deploy :
181
- name : deploy-staging
182
- context : STAGING
183
- serviceName : api-staging
184
- requires :
185
- - test-flask
186
- - build-react-for-staging
187
- filters :
188
- branches :
189
- only : master
190
-
191
- # deploy to demo
192
- - deploy :
193
- name : deploy-demo
194
- context : DEMO
195
- serviceName : api-demo
196
- filters :
197
- branches :
198
- only : production
199
-
200
- # deploy to production
201
- - deploy :
202
- name : deploy-production
203
- context : PRODUCTION
204
- serviceName : api-production
205
- filters :
206
- branches :
207
- only : production
208
- # nightly workflow to deploy master from React each night
209
- nightly :
210
- triggers :
211
- - schedule :
212
- cron : " 0 5 * * *"
213
- filters :
214
- branches :
215
- only :
216
- - master
217
- jobs :
218
- - build-flask
219
-
172
+ - checkout-to-workspace
173
+ - build-flask :
174
+ requires :
175
+ - checkout-to-workspace
220
176
- test-flask :
221
177
requires :
222
178
- build-flask
223
-
224
179
- build-react :
225
- name : build-react-for-staging
226
- context : STAGING
227
- filters :
228
- branches :
229
- only : master
180
+ requires :
181
+ - checkout-to-workspace
230
182
231
183
# deploy to staging
232
184
- deploy :
@@ -235,7 +187,25 @@ workflows:
235
187
serviceName : api-staging
236
188
requires :
237
189
- test-flask
238
- - build-react-for-staging
190
+ - build-react
239
191
filters :
240
192
branches :
241
193
only : master
194
+
195
+ # deploy to demo
196
+ - deploy :
197
+ name : deploy-demo
198
+ context : DEMO
199
+ serviceName : api-demo
200
+ filters :
201
+ branches :
202
+ only : production
203
+
204
+ # deploy to production
205
+ - deploy :
206
+ name : deploy-production
207
+ context : PRODUCTION
208
+ serviceName : api-production
209
+ filters :
210
+ branches :
211
+ only : production
0 commit comments