How to Upload a Single File as an Artifact in GitHub Actions
Point path at a single file and upload-artifact zips just that file under the artifact name.
Set path: to the exact file path. The action still produces a zip, with the single file inside it.
Steps
- Produce the file you want to keep (for example
app.log). - Set
path:to that file, not its folder. - Download the artifact to get the zipped file back.
Workflow
.github/workflows/ci.yml
steps:
- run: ./build.sh > build.log
- uses: actions/upload-artifact@v4
with:
name: build-log
path: build.logGotchas
- The artifact is always a zip; even a single file is wrapped inside it.
- The path is relative to the workspace unless you give an absolute path.
Related guides
How to Upload a Build Artifact in GitHub ActionsUpload a build output as an artifact in GitHub Actions with actions/upload-artifact@v4, naming it and pointin…
How to Upload Multiple Paths as One Artifact in GitHub ActionsBundle several directories into a single GitHub Actions artifact by listing each path on its own line under t…