mirror of
https://github.com/actions/upload-artifact.git
synced 2025-04-06 06:29:37 +00:00
consume latest @actions/toolkit (#461)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import * as core from '../node_modules/@actions/core/'
|
||||
import {
|
||||
UploadArtifactOptions,
|
||||
create
|
||||
import artifact, {
|
||||
UploadArtifactOptions
|
||||
} from '../node_modules/@actions/artifact/lib/artifact'
|
||||
import {findFilesToUpload} from './search'
|
||||
import {getInputs} from './input-helper'
|
||||
@ -40,7 +39,6 @@ async function run(): Promise<void> {
|
||||
)
|
||||
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`)
|
||||
|
||||
const artifactClient = create()
|
||||
const options: UploadArtifactOptions = {}
|
||||
if (inputs.retentionDays) {
|
||||
options.retentionDays = inputs.retentionDays
|
||||
@ -50,23 +48,17 @@ async function run(): Promise<void> {
|
||||
options.compressionLevel = inputs.compressionLevel
|
||||
}
|
||||
|
||||
const uploadResponse = await artifactClient.uploadArtifact(
|
||||
const uploadResponse = await artifact.uploadArtifact(
|
||||
inputs.artifactName,
|
||||
searchResult.filesToUpload,
|
||||
searchResult.rootDirectory,
|
||||
options
|
||||
)
|
||||
|
||||
if (uploadResponse.success === false) {
|
||||
core.setFailed(
|
||||
`An error was encountered when uploading ${inputs.artifactName}.`
|
||||
)
|
||||
} else {
|
||||
core.info(
|
||||
`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`
|
||||
)
|
||||
core.setOutput('artifact-id', uploadResponse.id)
|
||||
}
|
||||
core.info(
|
||||
`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`
|
||||
)
|
||||
core.setOutput('artifact-id', uploadResponse.id)
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed((error as Error).message)
|
||||
|
Reference in New Issue
Block a user