How to Set Artifact Compression Level in GitHub Actions
compression-level (0 to 9) controls the zip compression, letting you trade CPU time for a smaller artifact.
Set compression-level: on actions/upload-artifact@v4. 0 stores with no compression (fast), 6 is the default, and 9 is smallest but slowest.
Steps
- Add
compression-level:to the upload step. - Use 0 for already-compressed files (images, zips, videos).
- Use 9 for large text output where size matters more than speed.
Workflow
.github/workflows/ci.yml
steps:
- uses: actions/upload-artifact@v4
with:
name: logs
path: logs/
compression-level: 9Gotchas
- Recompressing already-compressed data wastes CPU; use level 0 there.
- Valid values are 0 through 9; anything else fails validation.
Related guides
How to Upload a Large Artifact in GitHub ActionsUpload big outputs as a GitHub Actions artifact reliably by tarring first, excluding junk, and tuning compres…
How to Set a Custom Retention Window for an Artifact in GitHub ActionsControl how long a single GitHub Actions artifact is kept with the retention-days input of actions/upload-art…