actions/upload-artifact: Persist Build Outputs
upload-artifact saves files from a job so you can download them or pass them between jobs.
Use it to keep test reports, build bundles, or coverage. v4 artifacts are immutable per name and download faster than v3.
Key inputs (with:)
- name: artifact name (must be unique per run in v4).
- path: file/dir globs to upload (required).
- retention-days: how long to keep it (1-90).
- if-no-files-found: warn, error, or ignore.
- compression-level: 0-9 zip compression.
Example workflow
.github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7On any runner
Artifact upload works on any runner. Latchkey managed runners run it unchanged.
Key takeaways
- Artifact names must be unique per run in v4.
- Pair with download-artifact to pass files between jobs.
- Tune retention-days to control storage usage.
Related guides
actions/download-artifact: Retrieve Build OutputsReference for actions/download-artifact: pull artifacts uploaded earlier in the same run into a later job, in…
softprops/action-gh-release: Publish GitHub ReleasesReference for softprops/action-gh-release: create or update a GitHub Release on tag pushes and upload assets,…
actions/cache: Save & Restore Build CachesReference for actions/cache: cache dependencies and build outputs across runs using key and restore-keys, wit…