Created
September 23, 2018 16:54
-
-
Save unixfy/e79189482039d3fb3b186ffaf48c1942 to your computer and use it in GitHub Desktop.
CircleCI Publish Repo to S3 & Cloudfront config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/python:latest | |
steps: | |
- checkout | |
- store_artifacts: | |
path: /code/{{repo-name}} | |
destination: up | |
- run: | |
name: Install AWSCLI | |
command: sudo pip install awscli | |
- deploy: | |
name: Deploy to S3 and create Cloudfront invalidation if tests pass and branch is Master | |
command: | | |
if [ "${CIRCLE_BRANCH}" == "master" ]; then | |
aws s3 sync . s3://{{s3 bucket}} --delete && aws cloudfront create-invalidation --distribution-id {{dist id}} --paths "/*" | |
else | |
echo "Not master branch so not deploying" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment