This repo deploys its built static assets to AWS S3 via CircleCI. Deployments are implemented in .circleci/config.yml.
- Build output:
dist/THIRD-IRON-LIBKEY - Dev-test destination (feature branches):
s3://$AWS_BUCKET/primo-nde/dev-test - Staging destination:
s3://$AWS_BUCKET/primo-nde/staging - Production destination:
s3://$AWS_BUCKET/primo-nde/production
feature/*branches (CircleCI filter:/feature\/.*/): runsdeploy-to-dev-testdevelopbranch: runsdeploy-to-stagingmainbranch: runsdeploy-to-production
Both jobs run only after build-and-test succeeds.
Set these in CircleCI Project Settings → Environment Variables:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_DEFAULT_REGIONAWS_BUCKET(the bucket name)
CircleCI does:
- Install dependencies (
npm ci) - Build (
npm run build) - Install AWS CLI (via CircleCI orb)
- Upload build output to S3 using two sync passes:
- Pass 1 (long cache): upload non-HTML/non-JSON assets with
cache-control: max-age=31536000,public - Pass 2 (no cache): upload
*.htmland*.jsonwithcache-control: no-cache,no-store,must-revalidate
- Pass 1 (long cache): upload non-HTML/non-JSON assets with
This keeps hashed/static assets cacheable while ensuring entry-point files update immediately.
aws s3 sync dist/THIRD-IRON-LIBKEY s3://$AWS_BUCKET/primo-nde/<env> \
--delete \
--cache-control "max-age=31536000,public" \
--exclude "*.html" \
--exclude "*.json"aws s3 sync dist/THIRD-IRON-LIBKEY s3://$AWS_BUCKET/primo-nde/<env> \
--delete \
--cache-control "no-cache,no-store,must-revalidate" \
--exclude "*" \
--include "*.html" \
--include "*.json"Replace <env> with:
dev-test(forfeature/*)staging(fordevelop)production(formain)
If you need a reference bucket policy for public reads, see bucket-policy.json in this repo. This is an example of the bucket policy we currently use on S3 for this Primo NDE project.