Skip to content

Commit

Permalink
Fix deployment step of Circle 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
begedin committed Feb 12, 2018
1 parent 4f41648 commit 4290c33
Showing 1 changed file with 60 additions and 22 deletions.
82 changes: 60 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
defaults: &defaults
working_directory: ~/code-corps-api
docker:
- image: circleci/elixir:1.6-node-browsers
- image: circleci/postgres:9.4
environment:
POSTGRES_USER: ubuntu
- image: circleci/ruby:2.3

jobs:
build:
<<: *defaults
working_directory: ~/code-corps-api
docker:
- image: circleci/elixir:1.6-node-browsers
- image: circleci/postgres:9.4
environment:
POSTGRES_USER: ubuntu
steps:
- checkout
- restore_cache:
Expand Down Expand Up @@ -50,8 +46,7 @@ jobs:
- save_cache:
key: v1-build-cache
paths: "_build"
deploy-staging:
<<: *defaults
deploy-remote-development:
steps:
- checkout
- run:
Expand All @@ -66,20 +61,36 @@ jobs:
git push --force [email protected]:code-corps-remote-development.git HEAD:refs/heads/master
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-remote-development
heroku restart --app code-corps-remote-development
deploy-staging:
steps:
- checkout
- run:
name: Run Heroku setup script
command: bash .circleci/setup-heroku.sh
- add_ssh_keys:
fingerprints:
- "48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"
- run:
name: Push to Staging
command: |
git push --force [email protected]:code-corps-staging.git HEAD:refs/heads/master
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-staging
heroku restart --app code-corps-staging
deploy-staging-docs:
working_directory: ~/code-corps-api
docker:
- image: circleci/ruby:2.4
steps:
- run:
name: Update API Docs
command: |
gem install apiaryio
apiary publish --api-name="codecorpsapidevelop" --path ./blueprint/api.apib
./bin/deploy_docs.sh
name: Install Apiary
command: gem install apiaryio
- run:
name: Build API Docs
command: apiary publish --api-name="codecorpsapidevelop" --path ./blueprint/api.apib
- run:
name: Deploy Docs
command: ./bin/deploy_docs.sh
deploy-production:
<<: *defaults
steps:
- checkout
- run:
Expand All @@ -94,17 +105,32 @@ jobs:
git push --force [email protected]:code-corps.git HEAD:refs/heads/master
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps
heroku restart --app code-corps
deploy-production-docs:
working_directory: ~/code-corps-api
docker:
- image: circleci/ruby:2.4
steps:
- run:
name: Update API Docs
command: |
gem install apiaryio
apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
name: Install Apiary
command: gem install apiaryio
- run:
name: Build API Docs
command: apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
- run:
name: Deploy Docs
command: ./bin/deploy_docs.sh

workflows:
version: 2
build-deploy:
jobs:
- build
- deploy-remote-development:
requires:
- build
filters:
branches:
only: develop
- deploy-staging:
requires:
- build
Expand All @@ -117,3 +143,15 @@ workflows:
filters:
branches:
only: master
- deploy-staging-docs:
requires:
- deploy-staging
filtes:
branches:
only: develop
- deploy-production-docs:
requires:
- deploy-production
filtes:
branches:
only: develop

0 comments on commit 4290c33

Please sign in to comment.