Skip to content

Instantly share code, notes, and snippets.

@unixfy
Created September 23, 2018 16:54
Show Gist options
  • Save unixfy/e79189482039d3fb3b186ffaf48c1942 to your computer and use it in GitHub Desktop.
Save unixfy/e79189482039d3fb3b186ffaf48c1942 to your computer and use it in GitHub Desktop.
CircleCI Publish Repo to S3 & Cloudfront config
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