mirror of https://github.com/actions/toolkit
adding lock
parent
c7de68f215
commit
fe0c0de7db
|
@ -39,28 +39,29 @@ export async function createZipUploadStream(
|
||||||
|
|
||||||
zip.on('finish', zipFinishCallback)
|
zip.on('finish', zipFinishCallback)
|
||||||
zip.on('end', zipEndCallback)
|
zip.on('end', zipEndCallback)
|
||||||
const uploadFilePromises = uploadSpecification.map(async file => {
|
for (const file of uploadSpecification) {
|
||||||
return new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
if (file.sourcePath !== null) {
|
if (file.sourcePath !== null) {
|
||||||
|
// Add a normal file to the zip
|
||||||
zip.entry(
|
zip.entry(
|
||||||
createReadStream(file.sourcePath),
|
createReadStream(file.sourcePath),
|
||||||
{name: file.destinationPath},
|
{name: file.destinationPath},
|
||||||
(err, entry) => {
|
function (err, entry) {
|
||||||
|
core.debug(`Entry is: ${entry}`)
|
||||||
if (err) reject(err)
|
if (err) reject(err)
|
||||||
resolve(entry)
|
else resolve(entry)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
zip.entry(null, {name: file.destinationPath}, (err, entry) => {
|
zip.entry(null, {name: file.destinationPath}, function (err, entry) {
|
||||||
|
core.debug(`Entry is: ${entry}`)
|
||||||
if (err) reject(err)
|
if (err) reject(err)
|
||||||
resolve(entry)
|
else resolve(entry)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
await Promise.all(uploadFilePromises).then(result => {
|
|
||||||
core.debug(`Zip result is ${result}`)
|
|
||||||
zip.finalize()
|
zip.finalize()
|
||||||
const bufferSize = getUploadChunkSize()
|
const bufferSize = getUploadChunkSize()
|
||||||
const zipUploadStream = new ZipUploadStream(bufferSize)
|
const zipUploadStream = new ZipUploadStream(bufferSize)
|
||||||
|
@ -71,9 +72,6 @@ export async function createZipUploadStream(
|
||||||
`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
||||||
)
|
)
|
||||||
return zipUploadStream
|
return zipUploadStream
|
||||||
})
|
|
||||||
throw new Error('An error has occurred during zip creation for the artifact')
|
|
||||||
// zip.pipe(zipUploadStream)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
|
Loading…
Reference in New Issue