Created
September 13, 2021 07:59
-
-
Save victorighalo/eb8baecf595deba19edabc4be9ecf292 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
# Template React Deploy | |
# This template allows you to deploy your React app to an AWS S3 bucket and invalidate the old AWS Cloudfront distribution. | |
# The workflow allows running tests, code linting and security scans on feature branches (as well as master). | |
# The react app will be validated, deployed to S3 and trigger an AWS Cloudfront distribution invalidation to refresh the CDN caches after the code is merged to master. | |
# Prerequisites: $AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY setup in the Deployment variables. | |
# For advanced cases, please, follow examples from the pipe's: | |
# README https://bitbucket.org/atlassian/aws-s3-deploy/src/master/README.md | |
# README https://bitbucket.org/atlassian/aws-cloudfront-invalidate/src/master/README.md | |
image: node:10.15.3 | |
# Workflow Configuration | |
pipelines: | |
default: | |
- parallel: | |
- step: | |
name: Build | |
caches: | |
- node | |
script: | |
- npm install | |
branches: | |
'{rebrand-v3-webpack,staging}': | |
- parallel: | |
- step: | |
name: Build | |
caches: | |
- node | |
script: | |
- npm install | |
- npm run build | |
artifacts: | |
- dist/** | |
- step: | |
name: Security Scan | |
script: | |
# Run a security scan for sensitive data. | |
# See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security | |
- pipe: atlassian/git-secrets-scan:0.4.3 | |
- step: | |
name: Deploy to Production | |
deployment: Production | |
trigger: manual | |
clone: | |
enabled: false | |
script: | |
# sync your files to S3 | |
- pipe: atlassian/aws-s3-deploy:0.4.4 | |
variables: | |
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID | |
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY | |
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION | |
S3_BUCKET: $S3_BUCKET | |
LOCAL_PATH: / | |
# triggering a distribution invalidation to refresh the CDN caches | |
- pipe: atlassian/aws-cloudfront-invalidate:0.1.1 | |
variables: | |
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID | |
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY | |
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION | |
DISTRIBUTION_ID: $DISTRIBUTION_ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment