GitHub Actions: Artifacts Between Jobs
An artifact is a file saved from one job for another job to use. The build job uploads it, and a later job downloads it.
Upload the build output
This step saves the dist folder as an artifact named site.
- uses: actions/upload-artifact@v7
with:
name: site
path: dist/Download it in another job
This step fetches the artifact named site into the dist folder.
- uses: actions/download-artifact@v8
with:
name: site
path: distJobs that share a file
needs: says this job waits for the build job.
check:
needs: build
runs-on: ubuntu-latestExample
name: Artifacts demo
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24'
- run: npm run build
- uses: actions/upload-artifact@v7
with:
name: site
path: dist/
check:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
name: site
path: dist
- run: ls distKey points
- Artifact: a file saved from a run, kept after the job ends.
- upload-artifact saves files from a job.
- download-artifact fetches saved files into another job.
- Jobs run on separate machines, so they share nothing by default.
- The build job writes dist/index.html and uploads the dist folder.
- The second job downloads the artifact and lists it.
- Artifacts also appear on the run page for download.
- Build once, use twice. The second job never rebuilds.
- Artifacts carry files between jobs that cannot see each other.
In this example, the workflow runs on every push. The build job checks out the code, installs Node 24, and runs the build, which writes dist/index.html. It then uploads the dist folder as an artifact named site. The check job waits for the build job, downloads the artifact, and lists it. The file is there, so the build output crossed from one job to the other.
Note
upload-artifact is at @v7 and download-artifact is at @v8. The two actions have different major versions.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
Why does the second job need download-artifact?