Changes for README.md: 32 added lines, 1 removed line.
Original line number
Diff line number
Diff line
@@ -24,6 +24,7 @@ See also [download-artifact](https://github.com/actions/download-artifact).
-[Using Outputs](#using-outputs)
-[Example output between steps](#example-output-between-steps)
-[Example output between jobs](#example-output-between-jobs)
-[Overwriting an Artifact](#overwriting-an-artifact)
-[Limitations](#limitations)
-[Number of Artifacts](#number-of-artifacts)
-[Zip archives](#zip-archives)
@@ -44,7 +45,7 @@ For more information, see the [`@actions/artifact`](https://github.com/actions/t
1. Uploads are significantly faster, upwards of 90% improvement in worst case scenarios.
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.
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.
3. The contents of an Artifact are uploaded together into an _immutable_ archive. They cannot be altered by subsequent jobs unless the Artifacts are deleted and recreated (where they will have a new ID). Both of these factors help reduce the possibility of accidentally corrupting Artifact files.
4. The compression level of an Artifact can be manually tweaked for speed or size reduction.
### Breaking Changes
@@ -365,6 +366,36 @@ jobs:
run:echo "Artifact ID from previous job is $OUTPUT1"
```
### Overwriting an Artifact
Although it's not possible to mutate an Artifact, can completely overwrite one. But do note that this will give the Artifact a new ID, the previous one will no longer exist:
Changes for docs/MIGRATION.md: 64 added lines, 0 removed lines.
Original line number
Diff line number
Diff line
@@ -2,6 +2,7 @@
-[Migration](#migration)
-[Multiple uploads to the same named Artifact](#multiple-uploads-to-the-same-named-artifact)
-[Overwriting an Artifact](#overwriting-an-artifact)
Several behavioral differences exist between Artifact actions `v3` and below vs `v4`. This document outlines common scenarios in `v3`, and how they would be handled in `v4`.
@@ -78,3 +79,66 @@ jobs:
```
In `v4`, the new `pattern:` input will filter the downloaded Artifacts to match the name specified. The new `merge-multiple:` input will support downloading multiple Artifacts to the same directory. If the files within the Artifacts have the same name, the last writer wins.
## Overwriting an Artifact
In `v3`, the contents of an Artifact were mutable so something like the following was possible:
```yaml
jobs:
upload:
runs-on:ubuntu-latest
steps:
-name:Create a file
run:echo "hello world" > my-file.txt
-name:Upload Artifact
uses:actions/upload-artifact@v3
with:
name:my-artifact# NOTE: same artifact name
path:my-file.txt
upload-again:
needs:upload
runs-on:ubuntu-latest
steps:
-name:Create a different file
run:echo "goodbye world" > my-file.txt
-name:Upload Artifact
uses:actions/upload-artifact@v3
with:
name:my-artifact# NOTE: same artifact name
path:my-file.txt
```
The resulting `my-file.txt` in `my-artifact` will have "goodbye world" as the content.
In `v4`, Artifacts are immutable unless deleted. To achieve this same behavior, you can use `overwrite: true` to delete the Artifact before a new one is created:
```diff
jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Create a file
run: echo "hello world" > my-file.txt
- name: Upload Artifact
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: my-artifact # NOTE: same artifact name
path: my-file.txt
upload-again:
needs: upload
runs-on: ubuntu-latest
steps:
- name: Create a different file
run: echo "goodbye world" > my-file.txt
- name: Upload Artifact
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: my-artifact # NOTE: same artifact name
path: my-file.txt
+ overwrite: true
```
Note that this will create an _entirely_ new Artifact, with a different ID from the previous.