Support multiple unarchived file uploads
This commit is contained in:
Vendored
+16
-8
@@ -130597,14 +130597,6 @@ async function run() {
|
||||
const s = searchResult.filesToUpload.length === 1 ? '' : 's';
|
||||
info(`With the provided path, there will be ${searchResult.filesToUpload.length} file${s} uploaded`);
|
||||
core_debug(`Root artifact directory is ${searchResult.rootDirectory}`);
|
||||
// Validate that only a single file is uploaded when archive is false
|
||||
if (!inputs.archive && searchResult.filesToUpload.length > 1) {
|
||||
setFailed(`When 'archive' is set to false, only a single file can be uploaded. Found ${searchResult.filesToUpload.length} files to upload.`);
|
||||
return;
|
||||
}
|
||||
if (inputs.overwrite) {
|
||||
await deleteArtifactIfExists(inputs.artifactName);
|
||||
}
|
||||
const options = {};
|
||||
if (inputs.retentionDays) {
|
||||
options.retentionDays = inputs.retentionDays;
|
||||
@@ -130614,6 +130606,22 @@ async function run() {
|
||||
}
|
||||
if (!inputs.archive) {
|
||||
options.skipArchive = true;
|
||||
// Gitea patch: upstream upload-artifact@v7 only supports skipArchive
|
||||
// for one file per artifact. Accept multi-path/multi-file input by
|
||||
// creating one unarchived artifact for each matched file. In
|
||||
// skipArchive mode the library names the artifact after the file's
|
||||
// basename, matching upstream single-file behavior.
|
||||
for (const fileToUpload of searchResult.filesToUpload) {
|
||||
const artifactName = external_path_.basename(fileToUpload);
|
||||
if (inputs.overwrite) {
|
||||
await deleteArtifactIfExists(artifactName);
|
||||
}
|
||||
await upload_artifact_uploadArtifact(artifactName, [fileToUpload], searchResult.rootDirectory, options);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (inputs.overwrite) {
|
||||
await deleteArtifactIfExists(inputs.artifactName);
|
||||
}
|
||||
await upload_artifact_uploadArtifact(inputs.artifactName, searchResult.filesToUpload, searchResult.rootDirectory, options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user