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
{{ message }}
Repository navigation
Commit 11ff42c
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+32-1Lines changed: 32 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ See also [download-artifact](https://github.com/actions/download-artifact).
24
24
-[Using Outputs](#using-outputs)
25
25
-[Example output between steps](#example-output-between-steps)
26
26
-[Example output between jobs](#example-output-between-jobs)
27
+
-[Overwriting an Artifact](#overwriting-an-artifact)
27
28
-[Limitations](#limitations)
28
29
-[Number of Artifacts](#number-of-artifacts)
29
30
-[Zip archives](#zip-archives)
@@ -44,7 +45,7 @@ For more information, see the [`@actions/artifact`](https://github.com/actions/t
44
45
45
46
1. Uploads are significantly faster, upwards of 90% improvement in worst case scenarios.
46
47
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.
47
-
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.
48
+
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.
48
49
4. The compression level of an Artifact can be manually tweaked for speed or size reduction.
49
50
50
51
### Breaking Changes
@@ -365,6 +366,36 @@ jobs:
365
366
run: echo "Artifact ID from previous job is $OUTPUT1"
366
367
```
367
368
369
+
### Overwriting an Artifact
370
+
371
+
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:
Copy file name to clipboardExpand all lines: docs/MIGRATION.md
+64Lines changed: 64 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
-[Migration](#migration)
4
4
-[Multiple uploads to the same named Artifact](#multiple-uploads-to-the-same-named-artifact)
5
+
-[Overwriting an Artifact](#overwriting-an-artifact)
5
6
6
7
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`.
7
8
@@ -78,3 +79,66 @@ jobs:
78
79
```
79
80
80
81
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.
82
+
83
+
## Overwriting an Artifact
84
+
85
+
In `v3`, the contents of an Artifact were mutable so something like the following was possible:
86
+
87
+
```yaml
88
+
jobs:
89
+
upload:
90
+
runs-on: ubuntu-latest
91
+
steps:
92
+
- name: Create a file
93
+
run: echo "hello world" > my-file.txt
94
+
- name: Upload Artifact
95
+
uses: actions/upload-artifact@v3
96
+
with:
97
+
name: my-artifact # NOTE: same artifact name
98
+
path: my-file.txt
99
+
upload-again:
100
+
needs: upload
101
+
runs-on: ubuntu-latest
102
+
steps:
103
+
- name: Create a different file
104
+
run: echo "goodbye world" > my-file.txt
105
+
- name: Upload Artifact
106
+
uses: actions/upload-artifact@v3
107
+
with:
108
+
name: my-artifact # NOTE: same artifact name
109
+
path: my-file.txt
110
+
```
111
+
112
+
The resulting `my-file.txt` in `my-artifact` will have "goodbye world" as the content.
113
+
114
+
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:
115
+
116
+
```diff
117
+
jobs:
118
+
upload:
119
+
runs-on: ubuntu-latest
120
+
steps:
121
+
- name: Create a file
122
+
run: echo "hello world" > my-file.txt
123
+
- name: Upload Artifact
124
+
- uses: actions/upload-artifact@v3
125
+
+ uses: actions/upload-artifact@v4
126
+
with:
127
+
name: my-artifact # NOTE: same artifact name
128
+
path: my-file.txt
129
+
upload-again:
130
+
needs: upload
131
+
runs-on: ubuntu-latest
132
+
steps:
133
+
- name: Create a different file
134
+
run: echo "goodbye world" > my-file.txt
135
+
- name: Upload Artifact
136
+
- uses: actions/upload-artifact@v3
137
+
+ uses: actions/upload-artifact@v4
138
+
with:
139
+
name: my-artifact # NOTE: same artifact name
140
+
path: my-file.txt
141
+
+ overwrite: true
142
+
```
143
+
144
+
Note that this will create an _entirely_ new Artifact, with a different ID from the previous.
0 commit comments