Skip to content
Latchkey

How to Upload Build Artifacts in GitHub Actions

Artifacts let you persist build output, test reports, or logs and hand them to a later job.

Use actions/upload-artifact to store files after a job and actions/download-artifact to retrieve them in a downstream job that needs: the producer.

Upload then download

Name the artifact on upload; reference the same name on download in a dependent job.

.github/workflows/ci.yml
jobs:
  build:
    steps:
      - run: npm run build
      - uses: actions/upload-artifact@v4
        with:
          name: dist
          path: dist/
          retention-days: 7
  deploy:
    needs: build
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: dist
          path: dist/

Gotchas

  • v4 artifacts are immutable - uploading the same name twice in one run fails. Use a unique name (e.g. with ${{ matrix.os }}).
  • Default retention is 90 days (or your org limit); set retention-days to expire sooner and save storage.
  • Artifacts are zipped; very large trees are slow. Prefer caches for dependencies and artifacts for outputs.

Related guides

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