How to share files between steps on Bitbucket pipeline

engineering July 18, 2020
How to share files between steps on Bitbucket pipeline Rez Moss

Rez Moss

@rezmos1

bitbucket-pipelines.yml

    image: node:16

    pipelines:
      default:
            - step:
                name: Build 
                caches:
                  - node
                script:
                  - echo "Building files"
                  - yarn 
                  - yarn build ./dist
                artifacts: 
                  - dist            # means need to save dist folder and copy to next step
                  - dist/**         # means need to save dist folder and copy to next step
            - step:
                name: Use files from previous step
                image: atlassian/default-image:3
                caches:
                  - node
                script:
                  - zip -r file.zip dist
                artifacts: 
                  - file.zip      # means need to save file.zip folder and copy to next step
            - step:
                name: Upload file to S3
                image: atlassian/pipelines-awscli
                caches:
                  - node
                script:
                  - aws s3 cp file.zip s3://mys3-bucket/

Need expert advice? Schedule your AWS consultation today!

Schedule Now

Want to read more?

Back to Blog