version: 2 jobs: deploy: docker: - image: circleci/python:3.7 working_directory: ~/offen steps: - checkout - setup_remote_docker - run: name: Install deployment dependencies command: | sudo pip install -q awscli --upgrade - run: name: Build and deploy to S3 command: | if [ "${CIRCLE_BRANCH}" == "master" ]; then export SITEURL="https://www.offen.dev" export BUCKET="offen-dev-production" export DISTRIBUTION="E2UP8XHLFOC3QC" export ROBOTS_FILE="robots.txt.production" else export SITEURL="https://staging.offen.dev" export BUCKET="offen-dev-staging" export DISTRIBUTION="E13I20LK8ASYFH" export ROBOTS_FILE="robots.txt.staging" export OFFEN_ACCOUNT_ID="8f7ee44a-4cd8-47f2-a77e-8c7c98d46b89" fi make build aws s3 sync --delete ./output/. s3://$BUCKET aws cloudfront create-invalidation --distribution-id $DISTRIBUTION --paths "/*" workflows: version: 2 build_deploy: jobs: - deploy: filters: branches: only: - master - development