Skip to content

Instantly share code, notes, and snippets.

@alex3165
Created October 7, 2018 15:18
Show Gist options
  • Save alex3165/8d49e35c9ba719121fc96ede8ee07e77 to your computer and use it in GitHub Desktop.
Save alex3165/8d49e35c9ba719121fc96ede8ee07e77 to your computer and use it in GitHub Desktop.
Quick circleCI 2 config that works with react-script and deploy to aws
defaults: &defaults
docker:
- image: jtredoux/node-aws:latest
version: 2
jobs:
build:
<<: *defaults
steps:
- checkout
- run: npm install
- run: npm run build
- persist_to_workspace:
root: .
paths:
- build/*
deploy:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: build
- run: aws configure set default.region eu-west-2
- run: aws s3 sync build $S3_BUCKET --acl public-read --delete
workflows:
version: 2
release_branches:
jobs:
- build
- deploy:
requires:
- build
@alex3165
Copy link
Author

alex3165 commented Oct 7, 2018

Environment variables required:

  • AWS_ACCESS_KEY_ID : Create a circleCI IAM user with full access to your S3 bucket
  • AWS_SECRET_ACCESS_KEY : Create a circleCI IAM user with full access to your S3 bucket
  • S3_BUCKET : your s3 bucket name (example: s3://my-bucket-name)

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