image: node:latest
pipelines:
branches:
master:
- step:
name: Build Sites
caches:
- node
script:
- echo "Starting build process..."
- npm install
- npm run generate
artifacts:
- dist/**
- step:
name: Deploy to S3
image: amazon/aws-cli:latest
script:
- pipe: atlassian/aws-s3-deploy:1.6.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: 'us-east-1'
S3_BUCKET: '{BUCKET NAME}'
LOCAL_PATH: 'dist'
- step:
name: Invalidate CloudFront Cache
image: amazon/aws-cli:latest
script:
- echo "Invalidating CloudFront cache..."
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"