Skip to content

Instantly share code, notes, and snippets.

@christianklotz
Created May 9, 2017 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianklotz/175d0739c6f7517e564e0df7f44b687d to your computer and use it in GitHub Desktop.
Save christianklotz/175d0739c6f7517e564e0df7f44b687d to your computer and use it in GitHub Desktop.
Circle CI configuration with deployment stages
general:
artifacts:
- "coverage/lcov-report"
machine:
node:
version: 7.6.0
# environment:
# set the following variables in CircleCI project settings
# AWS_ACCESS_KEY_ID
# AWS_SECRET_ACCESS_KEY
# AWS_DEFAULT_REGION
# SLACK_URL
dependencies:
pre:
- sudo apt-get update && sudo apt-get install libpython2.7-dev
- sudo pip install awscli
post:
- npm run bootstrap
cache_directories:
- "packages/website/node_modules"
deployment:
# Commits to master deploy develop version
master:
branch: master
commands:
- cd packages/website; rm -r dist 2> /dev/null; npm run build; ./deploy.sh develop:
environment:
DEPLOYMENT_URL: https://develop.example.com # used to populate Slack message
NODE_ENV: production
S3_BUCKET: example.com-develop
# Staging and production deployments of the package are triggered by tagged commits.
website-staging:
tag: /^website\/v[0-9]+(\.[0-9]+)+-(beta|rc).[0-9]+$/ # limit tags with 'website/v1.2.3-beta.4' format
commands:
- cd packages/website; rm -r dist 2> /dev/null; npm run build; ./deploy.sh staging:
environment:
DEPLOYMENT_URL: https://staging.example.com
NODE_ENV: production
S3_BUCKET: example.com-staging
website:
tag: /^website\/v[0-9]+(\.[0-9]+)+$/ # limit tags to 'website/v1.2.3' format
commands:
- cd packages/website; rm -r dist 2> /dev/null; npm run build; ./deploy.sh production:
environment:
NODE_ENV: production
S3_BUCKET: example.com
@christianklotz
Copy link
Author

See https://philsturgeon.uk/2015/11/20/deploying-with-git-flow-tags-and-circleci for a more detailed description of the approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment