How to share files between steps on Bitbucket pipeline
1 min Read

How to share files between steps on Bitbucket pipeline

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/