Skip to content

Commit 488d755

Browse files
committed
Fix deployment process
1 parent 4f41648 commit 488d755

File tree

1 file changed

+69
-22
lines changed

1 file changed

+69
-22
lines changed

.circleci/config.yml

+69-22
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
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-
101
jobs:
112
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
139
steps:
1410
- checkout
1511
- restore_cache:
@@ -50,8 +46,10 @@ jobs:
5046
- save_cache:
5147
key: v1-build-cache
5248
paths: "_build"
53-
deploy-staging:
54-
<<: *defaults
49+
deploy-remote-development:
50+
working_directory: ~/code-corps-api
51+
docker:
52+
- image: buildpack-deps:trusty
5553
steps:
5654
- checkout
5755
- run:
@@ -66,20 +64,42 @@ jobs:
6664
git push --force [email protected]:code-corps-remote-development.git HEAD:refs/heads/master
6765
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-remote-development
6866
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"
6979
- run:
7080
name: Push to Staging
7181
command: |
7282
git push --force [email protected]:code-corps-staging.git HEAD:refs/heads/master
7383
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-staging
7484
heroku restart --app code-corps-staging
85+
deploy-staging-docs:
86+
working_directory: ~/code-corps-api
87+
docker:
88+
- image: circleci/ruby:2.4
89+
steps:
7590
- 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
91+
name: Install Apiary
92+
command: gem install apiaryio
93+
- run:
94+
name: Build API Docs
95+
command: apiary publish --api-name="codecorpsapidevelop" --path ./blueprint/api.apib
96+
- run:
97+
name: Deploy Docs
98+
command: ./bin/deploy_docs.sh
8199
deploy-production:
82-
<<: *defaults
100+
working_directory: ~/code-corps-api
101+
docker:
102+
- image: buildpack-deps:trusty
83103
steps:
84104
- checkout
85105
- run:
@@ -94,17 +114,32 @@ jobs:
94114
git push --force [email protected]:code-corps.git HEAD:refs/heads/master
95115
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps
96116
heroku restart --app code-corps
117+
deploy-production-docs:
118+
working_directory: ~/code-corps-api
119+
docker:
120+
- image: circleci/ruby:2.4
121+
steps:
97122
- run:
98-
name: Update API Docs
99-
command: |
100-
gem install apiaryio
101-
apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
123+
name: Install Apiary
124+
command: gem install apiaryio
125+
- run:
126+
name: Build API Docs
127+
command: apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
128+
- run:
129+
name: Deploy Docs
130+
command: ./bin/deploy_docs.sh
102131

103132
workflows:
104133
version: 2
105134
build-deploy:
106135
jobs:
107136
- build
137+
- deploy-remote-development:
138+
requires:
139+
- build
140+
filters:
141+
branches:
142+
only: develop
108143
- deploy-staging:
109144
requires:
110145
- build
@@ -117,3 +152,15 @@ workflows:
117152
filters:
118153
branches:
119154
only: master
155+
- deploy-staging-docs:
156+
requires:
157+
- build
158+
filters:
159+
branches:
160+
only: develop
161+
- deploy-production-docs:
162+
requires:
163+
- build
164+
filters:
165+
branches:
166+
only: master

0 commit comments

Comments
 (0)