How to Store Build Artifacts in CircleCI
CircleCI separates two concepts: store_artifacts for downloadable output, and workspaces for passing files between jobs.
Use store_artifacts to keep files you want to download from the UI. To pass files to a later job in the same workflow, use persist_to_workspace + attach_workspace.
Persist to a later job and store output
The build job persists dist/ to the workspace; deploy attaches it. store_artifacts makes a report downloadable.
.circleci/config.yml
jobs:
build:
docker: [{ image: cimg/node:20.11 }]
steps:
- checkout
- run: npm ci && npm run build
- persist_to_workspace:
root: .
paths: [dist]
- store_artifacts:
path: coverage
deploy:
docker: [{ image: cimg/base:current }]
steps:
- attach_workspace:
at: .
- run: ./deploy.sh dist/Gotchas
- Do not confuse the two:
store_artifactsis not readable by later jobs - only workspaces pass files downstream. - Workspace
pathsare relative toroot; attach at the same layout you persisted. - Artifacts have a storage retention limit set at the org level; do not rely on them long-term.
Related guides
How to Upload Build Artifacts in GitHub ActionsUpload and download build artifacts in GitHub Actions with actions/upload-artifact and download-artifact - pa…
How to Cache Dependencies in CircleCICache dependencies in CircleCI with save_cache and restore_cache - checksum-based keys, restore-key fallbacks…