mirror of
https://gitea.com/actions/upload-artifact.git
synced 2025-12-14 12:41:38 +08:00
Upload multiple artifacts
This commit is contained in:
@@ -40,21 +40,24 @@ async function run(): Promise<void> {
|
||||
const options: UploadOptions = {
|
||||
continueOnError: false
|
||||
}
|
||||
const uploadResponse = await artifactClient.uploadArtifact(
|
||||
inputs.artifactName,
|
||||
searchResult.filesToUpload,
|
||||
searchResult.rootDirectory,
|
||||
options
|
||||
)
|
||||
|
||||
if (uploadResponse.failedItems.length > 0) {
|
||||
core.setFailed(
|
||||
`An error was encountered when uploading ${uploadResponse.artifactName}. There were ${uploadResponse.failedItems.length} items that failed to upload.`
|
||||
)
|
||||
} else {
|
||||
core.info(
|
||||
`Artifact ${uploadResponse.artifactName} has been successfully uploaded!`
|
||||
for (const file of searchResult.filesToUpload) {
|
||||
const uploadResponse = await artifactClient.uploadArtifact(
|
||||
file,
|
||||
[file],
|
||||
searchResult.rootDirectory,
|
||||
options
|
||||
)
|
||||
|
||||
if (uploadResponse.failedItems.length > 0) {
|
||||
core.setFailed(
|
||||
`An error was encountered when uploading ${uploadResponse.artifactName}. There were ${uploadResponse.failedItems.length} items that failed to upload.`
|
||||
)
|
||||
} else {
|
||||
core.info(
|
||||
`Artifact ${uploadResponse.artifactName} has been successfully uploaded!`
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user