1
- defaults : &defaults
2
- working_directory : ~/code-corps-api
3
- docker :
4
- - image : circleci/elixir:1.6-node-browsers
5
- - image : circleci/postgres:9.4
6
- environment :
7
- POSTGRES_USER : ubuntu
8
- - image : circleci/ruby:2.3
9
-
10
1
jobs :
11
2
build :
12
- << : *defaults
3
+ working_directory : ~/code-corps-api
4
+ docker :
5
+ - image : circleci/elixir:1.6-node-browsers
6
+ - image : circleci/postgres:9.4
7
+ environment :
8
+ POSTGRES_USER : ubuntu
13
9
steps :
14
10
- checkout
15
11
- restore_cache :
50
46
- save_cache :
51
47
key : v1-build-cache
52
48
paths : " _build"
53
- deploy-staging :
54
- << : *defaults
49
+ deploy-remote-development :
50
+ working_directory : ~/code-corps-api
51
+ docker :
52
+ - image : buildpack-deps:trusty
55
53
steps :
56
54
- checkout
57
55
- run :
@@ -66,20 +64,28 @@ jobs:
66
64
git push --force [email protected] :code-corps-remote-development.git HEAD:refs/heads/master
67
65
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-remote-development
68
66
heroku restart --app code-corps-remote-development
67
+ deploy-staging :
68
+ working_directory : ~/code-corps-api
69
+ docker :
70
+ - image : buildpack-deps:trusty
71
+ steps :
72
+ - checkout
73
+ - run :
74
+ name : Run Heroku setup script
75
+ command : bash .circleci/setup-heroku.sh
76
+ - add_ssh_keys :
77
+ fingerprints :
78
+ - " 48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"
69
79
- run :
70
80
name : Push to Staging
71
81
command : |
72
82
git push --force [email protected] :code-corps-staging.git HEAD:refs/heads/master
73
83
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-staging
74
84
heroku restart --app code-corps-staging
75
- - run :
76
- name : Update API Docs
77
- command : |
78
- gem install apiaryio
79
- apiary publish --api-name="codecorpsapidevelop" --path ./blueprint/api.apib
80
- ./bin/deploy_docs.sh
81
85
deploy-production :
82
- << : *defaults
86
+ working_directory : ~/code-corps-api
87
+ docker :
88
+ - image : buildpack-deps:trusty
83
89
steps :
84
90
- checkout
85
91
- run :
@@ -94,26 +100,100 @@ jobs:
94
100
git push --force [email protected] :code-corps.git HEAD:refs/heads/master
95
101
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps
96
102
heroku restart --app code-corps
103
+ deploy-staging-apiary :
104
+ working_directory : ~/code-corps-api
105
+ docker :
106
+ - image : circleci/ruby:2.4
107
+ steps :
108
+ - checkout
97
109
- run :
98
- name : Update API Docs
99
- command : |
100
- gem install apiaryio
101
- apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
110
+ name : Install Apiary
111
+ command : gem install apiaryio
112
+ - run :
113
+ name : Deploy API Docs
114
+ command : apiary publish --api-name="codecorpsapidevelop" --path ./blueprint/api.apib
115
+ deploy-production-apiary :
116
+ working_directory : ~/code-corps-api
117
+ docker :
118
+ - image : circleci/ruby:2.4
119
+ steps :
120
+ - checkout
121
+ - run :
122
+ name : Install Apiary
123
+ command : gem install apiaryio
124
+ - run :
125
+ name : Deploy API Docs
126
+ command : apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
127
+ deploy-exdocs :
128
+ working_directory : ~/code-corps-api
129
+ docker :
130
+ - image : circleci/elixir:1.6
131
+ steps :
132
+ - checkout
133
+ - checkout
134
+ - restore_cache :
135
+ keys :
136
+ - v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
137
+ - v1-mix-cache-{{ .Branch }}
138
+ - v1-mix-cache
139
+ - restore_cache :
140
+ keys :
141
+ - v1-build-cache-{{ .Branch }}
142
+ - v1-build-cache
143
+ - run : mix local.hex --force
144
+ - run : mix local.rebar
145
+ - run : mix deps.get
146
+ - run :
147
+ name : Deploy Docs
148
+ command : ./bin/deploy_docs.sh
149
+ - save_cache :
150
+ key : v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
151
+ paths : " deps"
152
+ - save_cache :
153
+ key : v1-mix-cache-{{ .Branch }}
154
+ paths : " deps"
155
+ - save_cache :
156
+ key : v1-mix-cache
157
+ paths : " deps"
158
+ - save_cache :
159
+ key : v1-build-cache-{{ .Branch }}
160
+ paths : " _build"
161
+ - save_cache :
162
+ key : v1-build-cache
163
+ paths : " _build"
102
164
103
165
workflows :
104
166
version : 2
105
167
build-deploy :
106
168
jobs :
107
169
- build
170
+ - deploy-remote-development :
171
+ requires : build
172
+ filters :
173
+ branches :
174
+ only : develop
108
175
- deploy-staging :
109
- requires :
110
- - build
176
+ requires : build
111
177
filters :
112
178
branches :
113
179
only : develop
114
180
- deploy-production :
115
- requires :
116
- - build
181
+ requires : build
182
+ filters :
183
+ branches :
184
+ only : master
185
+ - deploy-staging-apiary :
186
+ requires : build
187
+ filters :
188
+ branches :
189
+ only : develop
190
+ - deploy-production-apiary :
191
+ requires : build
117
192
filters :
118
193
branches :
119
194
only : master
195
+ - deploy-exdocs :
196
+ requires : build
197
+ filters :
198
+ branches :
199
+ only : develop
0 commit comments