You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ See also [download-artifact](https://github.com/actions/download-artifact).
16
16
-[Upload an Entire Directory](#upload-an-entire-directory)
17
17
-[Upload using a Wildcard Pattern](#upload-using-a-wildcard-pattern)
18
18
-[Upload using Multiple Paths and Exclusions](#upload-using-multiple-paths-and-exclusions)
19
+
-[Altering compressions level (speed v. size)](#altering-compressions-level-speed-v-size)
19
20
-[Customization if no files are found](#customization-if-no-files-are-found)
20
21
-[(Not) Uploading to the same artifact](#not-uploading-to-the-same-artifact)
21
22
-[Environment Variables and Tilde Expansion](#environment-variables-and-tilde-expansion)
@@ -40,6 +41,7 @@ For more information, see the [`@actions/artifact`](https://github.com/actions/t
40
41
1. Uploads are significantly faster, upwards of 90% improvement in worst case scenarios.
41
42
2. Once uploaded, an Artifact ID is returned and Artifacts are immediately available in the UI and [REST API](https://docs.github.com/en/rest/actions/artifacts). Previously, you would have to wait for the run to be completed before an ID was available or any APIs could be utilized.
42
43
3. The contents of an Artifact are uploaded together into an _immutable_ archive. They cannot be altered by subsequent jobs. Both of these factors help reduce the possibility of accidentally corrupting Artifact files.
44
+
4. The compression level of an Artifact can be manually tweaked for speed or size reduction.
43
45
44
46
### Breaking Changes
45
47
@@ -156,6 +158,45 @@ If multiple paths are provided as input, the least common ancestor of all the se
156
158
157
159
Relative and absolute file paths are both allowed. Relative paths are rooted against the current working directory. Paths that begin with a wildcard character should be quoted to avoid being interpreted as YAML aliases.
158
160
161
+
### Altering compressions level (speed v. size)
162
+
163
+
If you are uploading large or easily compressable data to your artifact, you may benefit from tweaking the compression level. By default, the compression level is `6`, the same as GNU Gzip.
164
+
165
+
The value can range from 0 to 9:
166
+
- 0: No compression
167
+
- 1: Best speed
168
+
- 6: Default compression (same as GNU Gzip)
169
+
- 9: Best compression
170
+
171
+
Higher levels will result in better compression, but will take longer to complete.
172
+
For large files that are not easily compressed, a value of `0` is recommended for significantly faster uploads.
173
+
174
+
For instance, if you are uploading random binary data, you can save a lot of time by opting out of compression completely, since it won't benefit:
But, if you are uploading data that is easily compressed (like plaintext, code, etc) you can save space and cost by having a higher compression level. But this will be heavier on the CPU therefore slower to upload:
188
+
189
+
```yaml
190
+
- name: Make a file with a lot of repeated text
191
+
run: |
192
+
for i in {1..100000}; do echo -n 'foobar' >> foobar.txt; done
193
+
- uses: actions/upload-artifact@v4
194
+
with:
195
+
name: my-artifact
196
+
path: foobar.txt
197
+
compression-level: 9 # maximum compression
198
+
```
199
+
159
200
### Customization if no files are found
160
201
161
202
If a path (or paths), result in no files being found for the artifact, the action will succeed but print out a warning. In certain scenarios it may be desirable to fail the action or suppress the warning. The `if-no-files-found` option allows you to customize the behavior of the action if no files are found:
0 commit comments