Skip to content

Commit 46dfe17

Browse files
committed
Fix deployment process
1 parent 4f41648 commit 46dfe17

File tree

1 file changed

+71
-22
lines changed

1 file changed

+71
-22
lines changed

.circleci/config.yml

+71-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,43 @@ 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:
90+
- checkout
7591
- 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
92+
name: Install Apiary
93+
command: gem install apiaryio
94+
- run:
95+
name: Build API Docs
96+
command: apiary publish --api-name="codecorpsapidevelop" --path ./blueprint/api.apib
97+
- run:
98+
name: Deploy Docs
99+
command: ./bin/deploy_docs.sh
81100
deploy-production:
82-
<<: *defaults
101+
working_directory: ~/code-corps-api
102+
docker:
103+
- image: buildpack-deps:trusty
83104
steps:
84105
- checkout
85106
- run:
@@ -94,17 +115,33 @@ jobs:
94115
git push --force [email protected]:code-corps.git HEAD:refs/heads/master
95116
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps
96117
heroku restart --app code-corps
118+
deploy-production-docs:
119+
working_directory: ~/code-corps-api
120+
docker:
121+
- image: circleci/ruby:2.4
122+
steps:
123+
- checkout
97124
- run:
98-
name: Update API Docs
99-
command: |
100-
gem install apiaryio
101-
apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
125+
name: Install Apiary
126+
command: gem install apiaryio
127+
- run:
128+
name: Build API Docs
129+
command: apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
130+
- run:
131+
name: Deploy Docs
132+
command: ./bin/deploy_docs.sh
102133

103134
workflows:
104135
version: 2
105136
build-deploy:
106137
jobs:
107138
- build
139+
- deploy-remote-development:
140+
requires:
141+
- build
142+
filters:
143+
branches:
144+
only: develop
108145
- deploy-staging:
109146
requires:
110147
- build
@@ -117,3 +154,15 @@ workflows:
117154
filters:
118155
branches:
119156
only: master
157+
- deploy-staging-docs:
158+
requires:
159+
- build
160+
filters:
161+
branches:
162+
only: develop
163+
- deploy-production-docs:
164+
requires:
165+
- build
166+
filters:
167+
branches:
168+
only: master

0 commit comments

Comments
 (0)