Last active
September 7, 2023 08:49
-
-
Save Marcel-G/a73486322161c84757096a2e3855a3c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipelines: | |
branches: | |
master: | |
- step: | |
name: Build static html files | |
image: node:8.9.4-slim | |
caches: | |
- node | |
script: | |
- npm install | |
- rm -rf .next out # Remove built directories from previous builds (prevent EEXIST error) | |
- npm run export | |
- cp public/* out | |
artifacts: | |
- out/** | |
- step: | |
name: Deploy to S3 | |
image: atlassian/pipelines-awscli | |
# Sync to s3, update cache-control header for /static & /_next. Clear cloudfront cache. | |
# --metadata-directive REPLACE https://github.com/aws/aws-cli/issues/652 | |
script: | |
- aws s3 sync out/ s3://$ROOT_DOMAIN_NAME --acl public-read --delete | |
- aws s3 cp s3://$ROOT_DOMAIN_NAME/static/ s3://$ROOT_DOMAIN_NAME/static/ --metadata-directive REPLACE --cache-control 'max-age=31104000' --recursive | |
- aws s3 cp s3://$ROOT_DOMAIN_NAME/_next/ s3://$ROOT_DOMAIN_NAME/_next/ --metadata-directive REPLACE --cache-control 'max-age=31104000' --recursive | |
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you Marcel !