1
1
version : 2.1
2
2
orbs :
3
3
4
+
4
5
commands :
5
6
git_checkout_from_cache :
6
7
description : " Git checkout and save cache"
@@ -47,7 +48,7 @@ commands:
47
48
key : bundle-v1-{{ checksum "Gemfile" }}
48
49
paths :
49
50
- " modules"
50
- release :
51
+ build :
51
52
description : " Build Jekyll site"
52
53
steps :
53
54
- restore_cache :
@@ -63,7 +64,7 @@ commands:
63
64
key : _site-v1-{{ .Revision }}
64
65
paths :
65
66
- _site
66
- deploy_gh_pages :
67
+ deploy :
67
68
description : " Deploy to static branches"
68
69
parameters :
69
70
target_branch :
@@ -74,7 +75,7 @@ commands:
74
75
at : _site
75
76
- run :
76
77
name : Tag build
77
- command : echo "<< parameters.target_branch >> $(date)" > _site/version
78
+ command : echo "<< parameters.target_branch >> $(date -u +'%Y-%m-%dT%H:%M:%SZ' )" > _site/version
78
79
- run :
79
80
name : Install and configure dependencies
80
81
command : |
@@ -91,17 +92,14 @@ commands:
91
92
- run :
92
93
name : Deploy docs to gh-pages branch
93
94
command : /home/circleci/.npm-packages/bin/gh-pages -d _site --branch << parameters.target_branch >> --message '[skip ci]'
94
- docker_build :
95
+ docker_build_push :
95
96
description : " Build Docker image"
96
97
steps :
97
98
- setup_remote_docker
98
99
- run :
99
100
name : Building docker image
100
101
command : |
101
102
docker build -t ${DOCKHUB_ORGANISATION}/binary-static-academy:${CIRCLE_SHA1} -t ${DOCKHUB_ORGANISATION}/binary-static-academy:latest .
102
- docker_push :
103
- description : " Push image to docker hub"
104
- steps :
105
103
- run :
106
104
name : Pushing Image to docker hub
107
105
command : |
@@ -130,31 +128,58 @@ commands:
130
128
kubectl --server=${KUBE_SERVER} --certificate-authority=ca.crt --token=$SERVICEACCOUNT_TOKEN set image deployment/academy-binary-com academy-binary-com=${DOCKHUB_ORGANISATION}/binary-static-academy:${CIRCLE_SHA1}
131
129
fi
132
130
done
133
-
131
+ notify_slack :
132
+ description : " Notify slack"
133
+ steps :
134
+ - slack/status :
135
+ include_project_field : false
136
+ failure_message : " Release failed for Academy with version *$(cat _site/version)*"
137
+ success_message : " Release succeeded for Academy with version *$(cat _site/version)*"
138
+ webhook : ${SLACK_WEBHOOK}
134
139
jobs :
135
- release_production :
140
+ build :
136
141
docker :
137
142
- image : circleci/ruby:2.6.5
138
143
steps :
139
144
- git_checkout_from_cache
140
145
- bundle_install
141
- - release
142
- - docker_build
143
- - docker_push
144
- - k8s_deploy
145
- - deploy_gh_pages :
146
- target_branch : " production"
146
+ - build
147
147
release_staging :
148
148
docker :
149
149
- image : circleci/ruby:2.6.5
150
150
steps :
151
151
- git_checkout_from_cache
152
152
- bundle_install
153
- - release
154
- - deploy_gh_pages :
153
+ - build
154
+ - deploy :
155
155
target_branch : " staging"
156
-
156
+ - notify_slack
157
+ release_production :
158
+ docker :
159
+ - image : circleci/ruby:2.6.5
160
+ steps :
161
+ - git_checkout_from_cache
162
+ - bundle_install
163
+ - build
164
+ - deploy :
165
+ target_branch : " production"
166
+ - notify_slack
167
+ release_aws_production :
168
+ docker :
169
+ - image : circleci/ruby:2.6.5
170
+ steps :
171
+ - git_checkout_from_cache
172
+ - bundle_install
173
+ - build
174
+ - docker_build_push
175
+ - k8s_deploy
157
176
workflows :
177
+ build :
178
+ jobs :
179
+ - build :
180
+ filters :
181
+ branches :
182
+ ignore : /^master$/
158
183
release :
159
184
jobs :
160
185
- release_staging :
@@ -167,4 +192,10 @@ workflows:
167
192
ignore : /.*/
168
193
tags :
169
194
only : /^production.*/
195
+ - release_aws_production :
196
+ filters :
197
+ branches :
198
+ ignore : /.*/
199
+ tags :
200
+ only : /^production.*/
170
201
context : binary-frontend-artifact-upload
0 commit comments