How upload built file to S3 bucket in Bitbucket pipeline
engineering
July 18, 2020
Rez Moss
@rezmos11- Create new file in your Bitbucket repo bitbucket-pipelines.yml
2- Copy below code to file
image: node:16
pipelines:
default:
- step:
name: Build App
caches:
- node
script:
- echo "Building App"
- yarn
- yarn build
artifacts:
- build #Move build folder to next step
- build/**
- step:
name: Zip build folder
image: atlassian/default-image:3
caches:
- node
script:
- zip -r pkg.zip ./build
artifacts:
- pkg.zip #Move pkg.zip to next step
- step:
name: Upload to S3
deployment: staging
image: atlassian/pipelines-awscli
caches:
- node
script:
- aws s3 cp pkg.zip s3://MY-BUCKET/ #Copy pkg.zip to S3 bucket
3- Goto settings=> Deployment=> Staging => and add your AWS creds as secret
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
4- Push a code to your repo and enjoy