mirror of https://github.com/actions/toolkit
cleaning up unused imports
parent
14eee6f54a
commit
6e4aebbd4e
|
@ -1,4 +1,3 @@
|
||||||
import whyIsNodeRunning from 'why-is-node-running'
|
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import {
|
import {
|
||||||
UploadArtifactOptions,
|
UploadArtifactOptions,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import * as stream from 'stream'
|
import * as stream from 'stream'
|
||||||
import * as archiver from 'archiver'
|
|
||||||
import * as packer from 'zip-stream'
|
import * as packer from 'zip-stream'
|
||||||
|
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
|
@ -31,22 +30,10 @@ export async function createZipUploadStream(
|
||||||
core.debug(
|
core.debug(
|
||||||
`Creating Artifact archive with compressionLevel: ${compressionLevel}`
|
`Creating Artifact archive with compressionLevel: ${compressionLevel}`
|
||||||
)
|
)
|
||||||
// const zip2 = archiver.create('zip', {
|
|
||||||
// highWaterMark: getUploadChunkSize(),
|
|
||||||
// zlib: {level: compressionLevel}
|
|
||||||
// })
|
|
||||||
|
|
||||||
const zlibOptions = {
|
const zlibOptions = {
|
||||||
zlib: {level: compressionLevel, bufferSize: getUploadChunkSize()}
|
zlib: {level: compressionLevel, bufferSize: getUploadChunkSize()}
|
||||||
}
|
}
|
||||||
const zip = new packer(zlibOptions)
|
const zip = new packer(zlibOptions)
|
||||||
// zip.entry('string contents', {name: 'string.txt'}, function (err, entry) {
|
|
||||||
// if (err) throw err
|
|
||||||
// zip.entry(null, {name: 'directory/'}, function (err, entry) {
|
|
||||||
// if (err) throw err
|
|
||||||
// zip.finish()
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// register callbacks for various events during the zip lifecycle
|
// register callbacks for various events during the zip lifecycle
|
||||||
zip.on('error', err => {
|
zip.on('error', err => {
|
||||||
core.error('An error has occurred while creating the zip file for upload')
|
core.error('An error has occurred while creating the zip file for upload')
|
||||||
|
@ -70,39 +57,29 @@ export async function createZipUploadStream(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// zip.on('error', zipErrorCallback)
|
|
||||||
// zip.on('warning', zipWarningCallback)
|
|
||||||
zip.on('finish', () => {
|
zip.on('finish', () => {
|
||||||
core.debug('Zip stream for upload has finished.')
|
core.debug('Zip stream for upload has finished.')
|
||||||
})
|
})
|
||||||
zip.on('end', () => {
|
zip.on('end', () => {
|
||||||
core.debug('Zip stream for upload has ended.')
|
core.debug('Zip stream for upload has ended.')
|
||||||
})
|
})
|
||||||
// zip.on('end', zipEndCallback)
|
|
||||||
|
|
||||||
for (const file of uploadSpecification) {
|
for (const file of uploadSpecification) {
|
||||||
if (file.sourcePath !== null) {
|
if (file.sourcePath !== null) {
|
||||||
// Add a normal file to the zip
|
// Add a normal file to the zip
|
||||||
// zip.append(createReadStream(file.sourcePath), {
|
|
||||||
// name: file.destinationPath
|
|
||||||
// })
|
|
||||||
zip.entry(
|
zip.entry(
|
||||||
createReadStream(file.sourcePath),
|
createReadStream(file.sourcePath),
|
||||||
{name: file.destinationPath},
|
{name: file.destinationPath},
|
||||||
function (err, entry) {
|
function (err, entry) {
|
||||||
core.debug(`Entry is: ${entry}`)
|
core.debug(`Entry is: ${entry}`)
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
// zip.finish()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
zip.entry(null, {name: file.destinationPath}, function (err, entry) {
|
zip.entry(null, {name: file.destinationPath}, function (err, entry) {
|
||||||
core.debug(`Entry is: ${entry}`)
|
core.debug(`Entry is: ${entry}`)
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
// zip.finish()
|
|
||||||
})
|
})
|
||||||
// Add a directory to the zip
|
|
||||||
// zip.append('', {name: file.destinationPath})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +94,6 @@ export async function createZipUploadStream(
|
||||||
)
|
)
|
||||||
|
|
||||||
zip.pipe(zipUploadStream)
|
zip.pipe(zipUploadStream)
|
||||||
// zip.finalize()
|
|
||||||
zip.finalize()
|
zip.finalize()
|
||||||
return zipUploadStream
|
return zipUploadStream
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue