@actions/artifact 0.4.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +8 -8
- package/README.md +213 -213
- package/lib/artifact-client.d.ts +10 -10
- package/lib/artifact-client.js +10 -10
- package/lib/internal/artifact-client.d.ts +41 -41
- package/lib/internal/artifact-client.js +164 -148
- package/lib/internal/artifact-client.js.map +1 -1
- package/lib/internal/config-variables.d.ts +11 -11
- package/lib/internal/config-variables.js +70 -70
- package/lib/internal/contracts.d.ts +67 -57
- package/lib/internal/contracts.js +2 -2
- package/lib/internal/download-http-client.d.ts +39 -39
- package/lib/internal/download-http-client.js +271 -281
- package/lib/internal/download-http-client.js.map +1 -1
- package/lib/internal/download-options.d.ts +7 -7
- package/lib/internal/download-options.js +2 -2
- package/lib/internal/download-response.d.ts +10 -10
- package/lib/internal/download-response.js +2 -2
- package/lib/internal/download-specification.d.ts +19 -19
- package/lib/internal/download-specification.js +60 -60
- package/lib/internal/http-manager.d.ts +12 -12
- package/lib/internal/http-manager.js +30 -30
- package/lib/internal/path-and-artifact-name-validation.d.ts +8 -0
- package/lib/internal/path-and-artifact-name-validation.js +66 -0
- package/lib/internal/path-and-artifact-name-validation.js.map +1 -0
- package/lib/internal/requestUtils.d.ts +3 -0
- package/lib/internal/requestUtils.js +75 -0
- package/lib/internal/requestUtils.js.map +1 -0
- package/lib/internal/status-reporter.d.ts +21 -22
- package/lib/internal/status-reporter.js +50 -63
- package/lib/internal/status-reporter.js.map +1 -1
- package/lib/internal/upload-gzip.d.ts +14 -14
- package/lib/internal/upload-gzip.js +107 -88
- package/lib/internal/upload-gzip.js.map +1 -1
- package/lib/internal/upload-http-client.d.ts +48 -48
- package/lib/internal/upload-http-client.js +395 -376
- package/lib/internal/upload-http-client.js.map +1 -1
- package/lib/internal/upload-options.d.ts +34 -34
- package/lib/internal/upload-options.js +2 -2
- package/lib/internal/upload-response.d.ts +19 -19
- package/lib/internal/upload-response.js +2 -2
- package/lib/internal/upload-specification.d.ts +11 -11
- package/lib/internal/upload-specification.js +87 -87
- package/lib/internal/upload-specification.js.map +1 -1
- package/lib/internal/utils.d.ts +66 -73
- package/lib/internal/utils.js +262 -297
- package/lib/internal/utils.js.map +1 -1
- package/package.json +49 -49
package/LICENSE.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright 2019 GitHub
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright 2019 GitHub
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
9
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,213 +1,213 @@
|
|
|
1
|
-
# `@actions/artifact`
|
|
2
|
-
|
|
3
|
-
## Usage
|
|
4
|
-
|
|
5
|
-
You can use this package to interact with the actions artifacts.
|
|
6
|
-
- [Upload an Artifact](#Upload-an-Artifact)
|
|
7
|
-
- [Download a Single Artifact](#Download-a-Single-Artifact)
|
|
8
|
-
- [Download All Artifacts](#Download-all-Artifacts)
|
|
9
|
-
- [Additional Documentation](#Additional-Documentation)
|
|
10
|
-
- [Contributions](#Contributions)
|
|
11
|
-
|
|
12
|
-
Relative paths and absolute paths are both allowed. Relative paths are rooted against the current working directory.
|
|
13
|
-
|
|
14
|
-
## Upload an Artifact
|
|
15
|
-
|
|
16
|
-
Method Name: `uploadArtifact`
|
|
17
|
-
|
|
18
|
-
#### Inputs
|
|
19
|
-
- `name`
|
|
20
|
-
- The name of the artifact that is being uploaded
|
|
21
|
-
- Required
|
|
22
|
-
- `files`
|
|
23
|
-
- A list of file paths that describe what should be uploaded as part of the artifact
|
|
24
|
-
- If a path is provided that does not exist, an error will be thrown
|
|
25
|
-
- Can be absolute or relative. Internally everything is normalized and resolved
|
|
26
|
-
- Required
|
|
27
|
-
- `rootDirectory`
|
|
28
|
-
- A file path that denotes the root directory of the files being uploaded. This path is used to strip the paths provided in `files` to control how they are uploaded and structured
|
|
29
|
-
- If a file specified in `files` is not in the `rootDirectory`, an error will be thrown
|
|
30
|
-
- Required
|
|
31
|
-
- `options`
|
|
32
|
-
- Extra options that allow for the customization of the upload behavior
|
|
33
|
-
- Optional
|
|
34
|
-
|
|
35
|
-
#### Available Options
|
|
36
|
-
|
|
37
|
-
- `continueOnError`
|
|
38
|
-
- Indicates if the artifact upload should continue in the event a file fails to upload. If there is a error during upload, a partial artifact will always be created and available for download at the end. The `size` reported will be the amount of storage that the user or org will be charged for the partial artifact.
|
|
39
|
-
- If set to `false`, and an error is encountered, all other uploads will stop and any files that were queued will not be attempted to be uploaded. The partial artifact available will only include files up until the failure.
|
|
40
|
-
- If set to `true` and an error is encountered, the failed file will be skipped and ignored and all other queued files will be attempted to be uploaded. There will be an artifact available for download at the end with everything excluding the file that failed to upload
|
|
41
|
-
- Optional, defaults to `true` if not specified
|
|
42
|
-
- `retentionDays`
|
|
43
|
-
- Duration after which artifact will expire in days
|
|
44
|
-
- Minimum value: 1
|
|
45
|
-
- Maximum value: 90 unless changed by repository setting
|
|
46
|
-
- If this is set to a greater value than the retention settings allowed, the retention on artifacts will be reduced to match the max value allowed on the server, and the upload process will continue. An input of 0 assumes default retention value.
|
|
47
|
-
|
|
48
|
-
#### Example using Absolute File Paths
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
const artifact = require('@actions/artifact');
|
|
52
|
-
const artifactClient = artifact.create()
|
|
53
|
-
const artifactName = 'my-artifact';
|
|
54
|
-
const files = [
|
|
55
|
-
'/home/user/files/plz-upload/file1.txt',
|
|
56
|
-
'/home/user/files/plz-upload/file2.txt',
|
|
57
|
-
'/home/user/files/plz-upload/dir/file3.txt'
|
|
58
|
-
]
|
|
59
|
-
const rootDirectory = '/home/user/files/plz-upload'
|
|
60
|
-
const options = {
|
|
61
|
-
continueOnError: true
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const uploadResult = await artifactClient.uploadArtifact(artifactName, files, rootDirectory, options)
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
#### Example using Relative File Paths
|
|
68
|
-
```js
|
|
69
|
-
// Assuming the current working directory is /home/user/files/plz-upload
|
|
70
|
-
const artifact = require('@actions/artifact');
|
|
71
|
-
const artifactClient = artifact.create()
|
|
72
|
-
const artifactName = 'my-artifact';
|
|
73
|
-
const files = [
|
|
74
|
-
'file1.txt',
|
|
75
|
-
'file2.txt',
|
|
76
|
-
'dir/file3.txt'
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
const rootDirectory = '.' // Also possible to use __dirname
|
|
80
|
-
const options = {
|
|
81
|
-
continueOnError: false
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const uploadResponse = await artifactClient.uploadArtifact(artifactName, files, rootDirectory, options)
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
#### Upload Result
|
|
88
|
-
|
|
89
|
-
The returned `UploadResponse` will contain the following information
|
|
90
|
-
|
|
91
|
-
- `artifactName`
|
|
92
|
-
- The name of the artifact that was uploaded
|
|
93
|
-
- `artifactItems`
|
|
94
|
-
- A list of all files that describe what is uploaded if there are no errors encountered. Usually this will be equal to the inputted `files` with the exception of empty directories (will not be uploaded)
|
|
95
|
-
- `size`
|
|
96
|
-
- Total size of the artifact that was uploaded in bytes
|
|
97
|
-
- `failedItems`
|
|
98
|
-
- A list of items that were not uploaded successfully (this will include queued items that were not uploaded if `continueOnError` is set to false). This is a subset of `artifactItems`
|
|
99
|
-
|
|
100
|
-
## Download a Single Artifact
|
|
101
|
-
|
|
102
|
-
Method Name: `downloadArtifact`
|
|
103
|
-
|
|
104
|
-
#### Inputs
|
|
105
|
-
- `name`
|
|
106
|
-
- The name of the artifact to download
|
|
107
|
-
- Required
|
|
108
|
-
- `path`
|
|
109
|
-
- Path that denotes where the artifact will be downloaded to
|
|
110
|
-
- Optional. Defaults to the GitHub workspace directory(`$GITHUB_WORKSPACE`) if not specified
|
|
111
|
-
- `options`
|
|
112
|
-
- Extra options that allow for the customization of the download behavior
|
|
113
|
-
- Optional
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
#### Available Options
|
|
117
|
-
|
|
118
|
-
- `createArtifactFolder`
|
|
119
|
-
- Specifies if a folder (the artifact name) is created for the artifact that is downloaded (contents downloaded into this folder),
|
|
120
|
-
- Optional. Defaults to false if not specified
|
|
121
|
-
|
|
122
|
-
#### Example
|
|
123
|
-
|
|
124
|
-
```js
|
|
125
|
-
const artifact = require('@actions/artifact');
|
|
126
|
-
const artifactClient = artifact.create()
|
|
127
|
-
const artifactName = 'my-artifact';
|
|
128
|
-
const path = 'some/directory'
|
|
129
|
-
const options = {
|
|
130
|
-
createArtifactFolder: false
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const downloadResponse = await artifactClient.downloadArtifact(artifactName, path, options)
|
|
134
|
-
|
|
135
|
-
// Post download, the directory structure will look like this
|
|
136
|
-
/some
|
|
137
|
-
/directory
|
|
138
|
-
/file1.txt
|
|
139
|
-
/file2.txt
|
|
140
|
-
/dir
|
|
141
|
-
/file3.txt
|
|
142
|
-
|
|
143
|
-
// If createArtifactFolder is set to true, the directory structure will look like this
|
|
144
|
-
/some
|
|
145
|
-
/directory
|
|
146
|
-
/my-artifact
|
|
147
|
-
/file1.txt
|
|
148
|
-
/file2.txt
|
|
149
|
-
/dir
|
|
150
|
-
/file3.txt
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
#### Download Response
|
|
154
|
-
|
|
155
|
-
The returned `DownloadResponse` will contain the following information
|
|
156
|
-
|
|
157
|
-
- `artifactName`
|
|
158
|
-
- The name of the artifact that was downloaded
|
|
159
|
-
- `downloadPath`
|
|
160
|
-
- The full Path to where the artifact was downloaded
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
## Download All Artifacts
|
|
164
|
-
|
|
165
|
-
Method Name: `downloadAllArtifacts`
|
|
166
|
-
|
|
167
|
-
#### Inputs
|
|
168
|
-
- `path`
|
|
169
|
-
- Path that denotes where the artifact will be downloaded to
|
|
170
|
-
- Optional. Defaults to the GitHub workspace directory(`$GITHUB_WORKSPACE`) if not specified
|
|
171
|
-
|
|
172
|
-
```js
|
|
173
|
-
const artifact = require('@actions/artifact');
|
|
174
|
-
const artifactClient = artifact.create();
|
|
175
|
-
const downloadResponse = await artifactClient.downloadAllArtifacts();
|
|
176
|
-
|
|
177
|
-
// output result
|
|
178
|
-
for (response in downloadResponse) {
|
|
179
|
-
console.log(response.artifactName);
|
|
180
|
-
console.log(response.downloadPath);
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
Because there are multiple artifacts, an extra directory (denoted by the name of the artifact) will be created for each artifact in the path. With 2 artifacts(`my-artifact-1` and `my-artifact-2` for example) and the default path, the directory structure will be as follows:
|
|
185
|
-
```js
|
|
186
|
-
/GITHUB_WORKSPACE
|
|
187
|
-
/my-artifact-1
|
|
188
|
-
/ .. contents of `my-artifact-1`
|
|
189
|
-
/my-artifact-2
|
|
190
|
-
/ .. contents of `my-artifact-2`
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
#### Download Result
|
|
194
|
-
|
|
195
|
-
An array will be returned that describes the results for downloading all artifacts. The number of items in the array indicates the number of artifacts that were downloaded.
|
|
196
|
-
|
|
197
|
-
Each artifact will have the same `DownloadResponse` as if it was individually downloaded
|
|
198
|
-
- `artifactName`
|
|
199
|
-
- The name of the artifact that was downloaded
|
|
200
|
-
- `downloadPath`
|
|
201
|
-
- The full Path to where the artifact was downloaded
|
|
202
|
-
|
|
203
|
-
## Additional Documentation
|
|
204
|
-
|
|
205
|
-
Check out [additional-information](docs/additional-information.md) for extra documentation around usage, restrictions and behavior.
|
|
206
|
-
|
|
207
|
-
Check out [implementation-details](docs/implementation-details.md) for extra information about the implementation of this package.
|
|
208
|
-
|
|
209
|
-
## Contributions
|
|
210
|
-
|
|
211
|
-
See [contributor guidelines](https://github.com/actions/toolkit/blob/main/.github/CONTRIBUTING.md) for general guidelines and information about toolkit contributions.
|
|
212
|
-
|
|
213
|
-
For contributions related to this package, see [artifact contributions](CONTRIBUTIONS.md) for more information.
|
|
1
|
+
# `@actions/artifact`
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
You can use this package to interact with the actions artifacts.
|
|
6
|
+
- [Upload an Artifact](#Upload-an-Artifact)
|
|
7
|
+
- [Download a Single Artifact](#Download-a-Single-Artifact)
|
|
8
|
+
- [Download All Artifacts](#Download-all-Artifacts)
|
|
9
|
+
- [Additional Documentation](#Additional-Documentation)
|
|
10
|
+
- [Contributions](#Contributions)
|
|
11
|
+
|
|
12
|
+
Relative paths and absolute paths are both allowed. Relative paths are rooted against the current working directory.
|
|
13
|
+
|
|
14
|
+
## Upload an Artifact
|
|
15
|
+
|
|
16
|
+
Method Name: `uploadArtifact`
|
|
17
|
+
|
|
18
|
+
#### Inputs
|
|
19
|
+
- `name`
|
|
20
|
+
- The name of the artifact that is being uploaded
|
|
21
|
+
- Required
|
|
22
|
+
- `files`
|
|
23
|
+
- A list of file paths that describe what should be uploaded as part of the artifact
|
|
24
|
+
- If a path is provided that does not exist, an error will be thrown
|
|
25
|
+
- Can be absolute or relative. Internally everything is normalized and resolved
|
|
26
|
+
- Required
|
|
27
|
+
- `rootDirectory`
|
|
28
|
+
- A file path that denotes the root directory of the files being uploaded. This path is used to strip the paths provided in `files` to control how they are uploaded and structured
|
|
29
|
+
- If a file specified in `files` is not in the `rootDirectory`, an error will be thrown
|
|
30
|
+
- Required
|
|
31
|
+
- `options`
|
|
32
|
+
- Extra options that allow for the customization of the upload behavior
|
|
33
|
+
- Optional
|
|
34
|
+
|
|
35
|
+
#### Available Options
|
|
36
|
+
|
|
37
|
+
- `continueOnError`
|
|
38
|
+
- Indicates if the artifact upload should continue in the event a file fails to upload. If there is a error during upload, a partial artifact will always be created and available for download at the end. The `size` reported will be the amount of storage that the user or org will be charged for the partial artifact.
|
|
39
|
+
- If set to `false`, and an error is encountered, all other uploads will stop and any files that were queued will not be attempted to be uploaded. The partial artifact available will only include files up until the failure.
|
|
40
|
+
- If set to `true` and an error is encountered, the failed file will be skipped and ignored and all other queued files will be attempted to be uploaded. There will be an artifact available for download at the end with everything excluding the file that failed to upload
|
|
41
|
+
- Optional, defaults to `true` if not specified
|
|
42
|
+
- `retentionDays`
|
|
43
|
+
- Duration after which artifact will expire in days
|
|
44
|
+
- Minimum value: 1
|
|
45
|
+
- Maximum value: 90 unless changed by repository setting
|
|
46
|
+
- If this is set to a greater value than the retention settings allowed, the retention on artifacts will be reduced to match the max value allowed on the server, and the upload process will continue. An input of 0 assumes default retention value.
|
|
47
|
+
|
|
48
|
+
#### Example using Absolute File Paths
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
const artifact = require('@actions/artifact');
|
|
52
|
+
const artifactClient = artifact.create()
|
|
53
|
+
const artifactName = 'my-artifact';
|
|
54
|
+
const files = [
|
|
55
|
+
'/home/user/files/plz-upload/file1.txt',
|
|
56
|
+
'/home/user/files/plz-upload/file2.txt',
|
|
57
|
+
'/home/user/files/plz-upload/dir/file3.txt'
|
|
58
|
+
]
|
|
59
|
+
const rootDirectory = '/home/user/files/plz-upload'
|
|
60
|
+
const options = {
|
|
61
|
+
continueOnError: true
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const uploadResult = await artifactClient.uploadArtifact(artifactName, files, rootDirectory, options)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### Example using Relative File Paths
|
|
68
|
+
```js
|
|
69
|
+
// Assuming the current working directory is /home/user/files/plz-upload
|
|
70
|
+
const artifact = require('@actions/artifact');
|
|
71
|
+
const artifactClient = artifact.create()
|
|
72
|
+
const artifactName = 'my-artifact';
|
|
73
|
+
const files = [
|
|
74
|
+
'file1.txt',
|
|
75
|
+
'file2.txt',
|
|
76
|
+
'dir/file3.txt'
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
const rootDirectory = '.' // Also possible to use __dirname
|
|
80
|
+
const options = {
|
|
81
|
+
continueOnError: false
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const uploadResponse = await artifactClient.uploadArtifact(artifactName, files, rootDirectory, options)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Upload Result
|
|
88
|
+
|
|
89
|
+
The returned `UploadResponse` will contain the following information
|
|
90
|
+
|
|
91
|
+
- `artifactName`
|
|
92
|
+
- The name of the artifact that was uploaded
|
|
93
|
+
- `artifactItems`
|
|
94
|
+
- A list of all files that describe what is uploaded if there are no errors encountered. Usually this will be equal to the inputted `files` with the exception of empty directories (will not be uploaded)
|
|
95
|
+
- `size`
|
|
96
|
+
- Total size of the artifact that was uploaded in bytes
|
|
97
|
+
- `failedItems`
|
|
98
|
+
- A list of items that were not uploaded successfully (this will include queued items that were not uploaded if `continueOnError` is set to false). This is a subset of `artifactItems`
|
|
99
|
+
|
|
100
|
+
## Download a Single Artifact
|
|
101
|
+
|
|
102
|
+
Method Name: `downloadArtifact`
|
|
103
|
+
|
|
104
|
+
#### Inputs
|
|
105
|
+
- `name`
|
|
106
|
+
- The name of the artifact to download
|
|
107
|
+
- Required
|
|
108
|
+
- `path`
|
|
109
|
+
- Path that denotes where the artifact will be downloaded to
|
|
110
|
+
- Optional. Defaults to the GitHub workspace directory(`$GITHUB_WORKSPACE`) if not specified
|
|
111
|
+
- `options`
|
|
112
|
+
- Extra options that allow for the customization of the download behavior
|
|
113
|
+
- Optional
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
#### Available Options
|
|
117
|
+
|
|
118
|
+
- `createArtifactFolder`
|
|
119
|
+
- Specifies if a folder (the artifact name) is created for the artifact that is downloaded (contents downloaded into this folder),
|
|
120
|
+
- Optional. Defaults to false if not specified
|
|
121
|
+
|
|
122
|
+
#### Example
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
const artifact = require('@actions/artifact');
|
|
126
|
+
const artifactClient = artifact.create()
|
|
127
|
+
const artifactName = 'my-artifact';
|
|
128
|
+
const path = 'some/directory'
|
|
129
|
+
const options = {
|
|
130
|
+
createArtifactFolder: false
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const downloadResponse = await artifactClient.downloadArtifact(artifactName, path, options)
|
|
134
|
+
|
|
135
|
+
// Post download, the directory structure will look like this
|
|
136
|
+
/some
|
|
137
|
+
/directory
|
|
138
|
+
/file1.txt
|
|
139
|
+
/file2.txt
|
|
140
|
+
/dir
|
|
141
|
+
/file3.txt
|
|
142
|
+
|
|
143
|
+
// If createArtifactFolder is set to true, the directory structure will look like this
|
|
144
|
+
/some
|
|
145
|
+
/directory
|
|
146
|
+
/my-artifact
|
|
147
|
+
/file1.txt
|
|
148
|
+
/file2.txt
|
|
149
|
+
/dir
|
|
150
|
+
/file3.txt
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### Download Response
|
|
154
|
+
|
|
155
|
+
The returned `DownloadResponse` will contain the following information
|
|
156
|
+
|
|
157
|
+
- `artifactName`
|
|
158
|
+
- The name of the artifact that was downloaded
|
|
159
|
+
- `downloadPath`
|
|
160
|
+
- The full Path to where the artifact was downloaded
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
## Download All Artifacts
|
|
164
|
+
|
|
165
|
+
Method Name: `downloadAllArtifacts`
|
|
166
|
+
|
|
167
|
+
#### Inputs
|
|
168
|
+
- `path`
|
|
169
|
+
- Path that denotes where the artifact will be downloaded to
|
|
170
|
+
- Optional. Defaults to the GitHub workspace directory(`$GITHUB_WORKSPACE`) if not specified
|
|
171
|
+
|
|
172
|
+
```js
|
|
173
|
+
const artifact = require('@actions/artifact');
|
|
174
|
+
const artifactClient = artifact.create();
|
|
175
|
+
const downloadResponse = await artifactClient.downloadAllArtifacts();
|
|
176
|
+
|
|
177
|
+
// output result
|
|
178
|
+
for (response in downloadResponse) {
|
|
179
|
+
console.log(response.artifactName);
|
|
180
|
+
console.log(response.downloadPath);
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Because there are multiple artifacts, an extra directory (denoted by the name of the artifact) will be created for each artifact in the path. With 2 artifacts(`my-artifact-1` and `my-artifact-2` for example) and the default path, the directory structure will be as follows:
|
|
185
|
+
```js
|
|
186
|
+
/GITHUB_WORKSPACE
|
|
187
|
+
/my-artifact-1
|
|
188
|
+
/ .. contents of `my-artifact-1`
|
|
189
|
+
/my-artifact-2
|
|
190
|
+
/ .. contents of `my-artifact-2`
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### Download Result
|
|
194
|
+
|
|
195
|
+
An array will be returned that describes the results for downloading all artifacts. The number of items in the array indicates the number of artifacts that were downloaded.
|
|
196
|
+
|
|
197
|
+
Each artifact will have the same `DownloadResponse` as if it was individually downloaded
|
|
198
|
+
- `artifactName`
|
|
199
|
+
- The name of the artifact that was downloaded
|
|
200
|
+
- `downloadPath`
|
|
201
|
+
- The full Path to where the artifact was downloaded
|
|
202
|
+
|
|
203
|
+
## Additional Documentation
|
|
204
|
+
|
|
205
|
+
Check out [additional-information](docs/additional-information.md) for extra documentation around usage, restrictions and behavior.
|
|
206
|
+
|
|
207
|
+
Check out [implementation-details](docs/implementation-details.md) for extra information about the implementation of this package.
|
|
208
|
+
|
|
209
|
+
## Contributions
|
|
210
|
+
|
|
211
|
+
See [contributor guidelines](https://github.com/actions/toolkit/blob/main/.github/CONTRIBUTING.md) for general guidelines and information about toolkit contributions.
|
|
212
|
+
|
|
213
|
+
For contributions related to this package, see [artifact contributions](CONTRIBUTIONS.md) for more information.
|
package/lib/artifact-client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { UploadOptions } from './internal/upload-options';
|
|
2
|
-
import { UploadResponse } from './internal/upload-response';
|
|
3
|
-
import { DownloadOptions } from './internal/download-options';
|
|
4
|
-
import { DownloadResponse } from './internal/download-response';
|
|
5
|
-
import { ArtifactClient } from './internal/artifact-client';
|
|
6
|
-
export { ArtifactClient, UploadResponse, UploadOptions, DownloadResponse, DownloadOptions };
|
|
7
|
-
/**
|
|
8
|
-
* Constructs an ArtifactClient
|
|
9
|
-
*/
|
|
10
|
-
export declare function create(): ArtifactClient;
|
|
1
|
+
import { UploadOptions } from './internal/upload-options';
|
|
2
|
+
import { UploadResponse } from './internal/upload-response';
|
|
3
|
+
import { DownloadOptions } from './internal/download-options';
|
|
4
|
+
import { DownloadResponse } from './internal/download-response';
|
|
5
|
+
import { ArtifactClient } from './internal/artifact-client';
|
|
6
|
+
export { ArtifactClient, UploadResponse, UploadOptions, DownloadResponse, DownloadOptions };
|
|
7
|
+
/**
|
|
8
|
+
* Constructs an ArtifactClient
|
|
9
|
+
*/
|
|
10
|
+
export declare function create(): ArtifactClient;
|
package/lib/artifact-client.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const artifact_client_1 = require("./internal/artifact-client");
|
|
4
|
-
/**
|
|
5
|
-
* Constructs an ArtifactClient
|
|
6
|
-
*/
|
|
7
|
-
function create() {
|
|
8
|
-
return artifact_client_1.DefaultArtifactClient.create();
|
|
9
|
-
}
|
|
10
|
-
exports.create = create;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const artifact_client_1 = require("./internal/artifact-client");
|
|
4
|
+
/**
|
|
5
|
+
* Constructs an ArtifactClient
|
|
6
|
+
*/
|
|
7
|
+
function create() {
|
|
8
|
+
return artifact_client_1.DefaultArtifactClient.create();
|
|
9
|
+
}
|
|
10
|
+
exports.create = create;
|
|
11
11
|
//# sourceMappingURL=artifact-client.js.map
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { UploadResponse } from './upload-response';
|
|
2
|
-
import { UploadOptions } from './upload-options';
|
|
3
|
-
import { DownloadOptions } from './download-options';
|
|
4
|
-
import { DownloadResponse } from './download-response';
|
|
5
|
-
export interface ArtifactClient {
|
|
6
|
-
/**
|
|
7
|
-
* Uploads an artifact
|
|
8
|
-
*
|
|
9
|
-
* @param name the name of the artifact, required
|
|
10
|
-
* @param files a list of absolute or relative paths that denote what files should be uploaded
|
|
11
|
-
* @param rootDirectory an absolute or relative file path that denotes the root parent directory of the files being uploaded
|
|
12
|
-
* @param options extra options for customizing the upload behavior
|
|
13
|
-
* @returns single UploadInfo object
|
|
14
|
-
*/
|
|
15
|
-
uploadArtifact(name: string, files: string[], rootDirectory: string, options?: UploadOptions): Promise<UploadResponse>;
|
|
16
|
-
/**
|
|
17
|
-
* Downloads a single artifact associated with a run
|
|
18
|
-
*
|
|
19
|
-
* @param name the name of the artifact being downloaded
|
|
20
|
-
* @param path optional path that denotes where the artifact will be downloaded to
|
|
21
|
-
* @param options extra options that allow for the customization of the download behavior
|
|
22
|
-
*/
|
|
23
|
-
downloadArtifact(name: string, path?: string, options?: DownloadOptions): Promise<DownloadResponse>;
|
|
24
|
-
/**
|
|
25
|
-
* Downloads all artifacts associated with a run. Because there are multiple artifacts being downloaded, a folder will be created for each one in the specified or default directory
|
|
26
|
-
* @param path optional path that denotes where the artifacts will be downloaded to
|
|
27
|
-
*/
|
|
28
|
-
downloadAllArtifacts(path?: string): Promise<DownloadResponse[]>;
|
|
29
|
-
}
|
|
30
|
-
export declare class DefaultArtifactClient implements ArtifactClient {
|
|
31
|
-
/**
|
|
32
|
-
* Constructs a DefaultArtifactClient
|
|
33
|
-
*/
|
|
34
|
-
static create(): DefaultArtifactClient;
|
|
35
|
-
/**
|
|
36
|
-
* Uploads an artifact
|
|
37
|
-
*/
|
|
38
|
-
uploadArtifact(name: string, files: string[], rootDirectory: string, options?: UploadOptions | undefined): Promise<UploadResponse>;
|
|
39
|
-
downloadArtifact(name: string, path?: string | undefined, options?: DownloadOptions | undefined): Promise<DownloadResponse>;
|
|
40
|
-
downloadAllArtifacts(path?: string | undefined): Promise<DownloadResponse[]>;
|
|
41
|
-
}
|
|
1
|
+
import { UploadResponse } from './upload-response';
|
|
2
|
+
import { UploadOptions } from './upload-options';
|
|
3
|
+
import { DownloadOptions } from './download-options';
|
|
4
|
+
import { DownloadResponse } from './download-response';
|
|
5
|
+
export interface ArtifactClient {
|
|
6
|
+
/**
|
|
7
|
+
* Uploads an artifact
|
|
8
|
+
*
|
|
9
|
+
* @param name the name of the artifact, required
|
|
10
|
+
* @param files a list of absolute or relative paths that denote what files should be uploaded
|
|
11
|
+
* @param rootDirectory an absolute or relative file path that denotes the root parent directory of the files being uploaded
|
|
12
|
+
* @param options extra options for customizing the upload behavior
|
|
13
|
+
* @returns single UploadInfo object
|
|
14
|
+
*/
|
|
15
|
+
uploadArtifact(name: string, files: string[], rootDirectory: string, options?: UploadOptions): Promise<UploadResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Downloads a single artifact associated with a run
|
|
18
|
+
*
|
|
19
|
+
* @param name the name of the artifact being downloaded
|
|
20
|
+
* @param path optional path that denotes where the artifact will be downloaded to
|
|
21
|
+
* @param options extra options that allow for the customization of the download behavior
|
|
22
|
+
*/
|
|
23
|
+
downloadArtifact(name: string, path?: string, options?: DownloadOptions): Promise<DownloadResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Downloads all artifacts associated with a run. Because there are multiple artifacts being downloaded, a folder will be created for each one in the specified or default directory
|
|
26
|
+
* @param path optional path that denotes where the artifacts will be downloaded to
|
|
27
|
+
*/
|
|
28
|
+
downloadAllArtifacts(path?: string): Promise<DownloadResponse[]>;
|
|
29
|
+
}
|
|
30
|
+
export declare class DefaultArtifactClient implements ArtifactClient {
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a DefaultArtifactClient
|
|
33
|
+
*/
|
|
34
|
+
static create(): DefaultArtifactClient;
|
|
35
|
+
/**
|
|
36
|
+
* Uploads an artifact
|
|
37
|
+
*/
|
|
38
|
+
uploadArtifact(name: string, files: string[], rootDirectory: string, options?: UploadOptions | undefined): Promise<UploadResponse>;
|
|
39
|
+
downloadArtifact(name: string, path?: string | undefined, options?: DownloadOptions | undefined): Promise<DownloadResponse>;
|
|
40
|
+
downloadAllArtifacts(path?: string | undefined): Promise<DownloadResponse[]>;
|
|
41
|
+
}
|