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,17 +100,83 @@ 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
109
+ - run :
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
+ - restore_cache :
134
+ keys :
135
+ - v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
136
+ - v1-mix-cache-{{ .Branch }}
137
+ - v1-mix-cache
138
+ - restore_cache :
139
+ keys :
140
+ - v1-build-cache-{{ .Branch }}
141
+ - v1-build-cache
142
+ - run : mix local.hex --force
143
+ - run : mix local.rebar
144
+ - run : mix deps.get
97
145
- run :
98
- name : Update API Docs
146
+ name : Identify as user on GitHub
99
147
command : |
100
- gem install apiaryio
101
- apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
148
+ git config --global user.email "[email protected] "
149
+ git config --global user.name "joshsmith"
150
+ - run :
151
+ name : Deploy Docs
152
+ command : ./bin/deploy_docs.sh
153
+ - save_cache :
154
+ key : v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
155
+ paths : " deps"
156
+ - save_cache :
157
+ key : v1-mix-cache-{{ .Branch }}
158
+ paths : " deps"
159
+ - save_cache :
160
+ key : v1-mix-cache
161
+ paths : " deps"
162
+ - save_cache :
163
+ key : v1-build-cache-{{ .Branch }}
164
+ paths : " _build"
165
+ - save_cache :
166
+ key : v1-build-cache
167
+ paths : " _build"
102
168
103
169
workflows :
104
170
version : 2
105
171
build-deploy :
106
172
jobs :
107
173
- build
174
+ - deploy-remote-development :
175
+ requires :
176
+ - build
177
+ filters :
178
+ branches :
179
+ only : develop
108
180
- deploy-staging :
109
181
requires :
110
182
- build
@@ -117,3 +189,21 @@ workflows:
117
189
filters :
118
190
branches :
119
191
only : master
192
+ - deploy-staging-apiary :
193
+ requires :
194
+ - build
195
+ filters :
196
+ branches :
197
+ only : develop
198
+ - deploy-production-apiary :
199
+ requires :
200
+ - build
201
+ filters :
202
+ branches :
203
+ only : master
204
+ - deploy-exdocs :
205
+ requires :
206
+ - build
207
+ filters :
208
+ branches :
209
+ only : develop
0 commit comments