Skip to content
Latchkey

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_artifacts is not readable by later jobs - only workspaces pass files downstream.
  • Workspace paths are relative to root; 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

Run this faster and cheaper on Latchkey managed runners. Start free →