Skip to content

Commit 4290c33

Browse files
committed
Fix deployment step of Circle 2.0
1 parent 4f41648 commit 4290c33

File tree

1 file changed

+60
-22
lines changed

1 file changed

+60
-22
lines changed

.circleci/config.yml

+60-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,7 @@ jobs:
5046
- save_cache:
5147
key: v1-build-cache
5248
paths: "_build"
53-
deploy-staging:
54-
<<: *defaults
49+
deploy-remote-development:
5550
steps:
5651
- checkout
5752
- run:
@@ -66,20 +61,36 @@ jobs:
6661
git push --force [email protected]:code-corps-remote-development.git HEAD:refs/heads/master
6762
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-remote-development
6863
heroku restart --app code-corps-remote-development
64+
deploy-staging:
65+
steps:
66+
- checkout
67+
- run:
68+
name: Run Heroku setup script
69+
command: bash .circleci/setup-heroku.sh
70+
- add_ssh_keys:
71+
fingerprints:
72+
- "48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"
6973
- run:
7074
name: Push to Staging
7175
command: |
7276
git push --force [email protected]:code-corps-staging.git HEAD:refs/heads/master
7377
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-staging
7478
heroku restart --app code-corps-staging
79+
deploy-staging-docs:
80+
working_directory: ~/code-corps-api
81+
docker:
82+
- image: circleci/ruby:2.4
83+
steps:
7584
- 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
85+
name: Install Apiary
86+
command: gem install apiaryio
87+
- run:
88+
name: Build API Docs
89+
command: apiary publish --api-name="codecorpsapidevelop" --path ./blueprint/api.apib
90+
- run:
91+
name: Deploy Docs
92+
command: ./bin/deploy_docs.sh
8193
deploy-production:
82-
<<: *defaults
8394
steps:
8495
- checkout
8596
- run:
@@ -94,17 +105,32 @@ jobs:
94105
git push --force [email protected]:code-corps.git HEAD:refs/heads/master
95106
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps
96107
heroku restart --app code-corps
108+
deploy-production-docs:
109+
working_directory: ~/code-corps-api
110+
docker:
111+
- image: circleci/ruby:2.4
112+
steps:
97113
- run:
98-
name: Update API Docs
99-
command: |
100-
gem install apiaryio
101-
apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
114+
name: Install Apiary
115+
command: gem install apiaryio
116+
- run:
117+
name: Build API Docs
118+
command: apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
119+
- run:
120+
name: Deploy Docs
121+
command: ./bin/deploy_docs.sh
102122

103123
workflows:
104124
version: 2
105125
build-deploy:
106126
jobs:
107127
- build
128+
- deploy-remote-development:
129+
requires:
130+
- build
131+
filters:
132+
branches:
133+
only: develop
108134
- deploy-staging:
109135
requires:
110136
- build
@@ -117,3 +143,15 @@ workflows:
117143
filters:
118144
branches:
119145
only: master
146+
- deploy-staging-docs:
147+
requires:
148+
- deploy-staging
149+
filtes:
150+
branches:
151+
only: develop
152+
- deploy-production-docs:
153+
requires:
154+
- deploy-production
155+
filtes:
156+
branches:
157+
only: develop

0 commit comments

Comments
 (0)