How to Upload a Build Artifact in GitHub Actions
actions/upload-artifact@v4 zips a path and stores it against the run so you can download it later.
Add a step with actions/upload-artifact@v4, set name: to identify the artifact, and set path: to the file or directory to keep.
Steps
- Build the output you want to persist (for example
dist/). - Add
actions/upload-artifact@v4with aname:and apath:. - Open the run summary to download the zipped artifact.
Workflow
.github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/Gotchas
- v4 stores each artifact as an immutable zip; the
namemust be unique within a run. - The artifact appears under the run summary once the job finishes, not mid-run.
Related guides
How to Download an Artifact in the Same Workflow in GitHub ActionsDownload an artifact within the same GitHub Actions run using actions/download-artifact@v4, restoring files a…
How to Upload a Single File as an Artifact in GitHub ActionsUpload one file as a GitHub Actions artifact by pointing the path input of actions/upload-artifact@v4 at that…