mirror of
https://code.forgejo.org/forgejo/upload-artifact
synced 2026-09-07 08:21:46 -04:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48377050ae | ||
|
|
eba2a242da |
Vendored
+112
-3333
File diff suppressed because one or more lines are too long
+3
-11
@@ -1,7 +1,6 @@
|
|||||||
import * as core from '../node_modules/@actions/core/'
|
import * as core from '../node_modules/@actions/core/'
|
||||||
import {
|
import artifact, {
|
||||||
UploadArtifactOptions,
|
UploadArtifactOptions
|
||||||
create
|
|
||||||
} from '../node_modules/@actions/artifact/lib/artifact'
|
} from '../node_modules/@actions/artifact/lib/artifact'
|
||||||
import {findFilesToUpload} from './search'
|
import {findFilesToUpload} from './search'
|
||||||
import {getInputs} from './input-helper'
|
import {getInputs} from './input-helper'
|
||||||
@@ -40,7 +39,6 @@ async function run(): Promise<void> {
|
|||||||
)
|
)
|
||||||
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`)
|
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`)
|
||||||
|
|
||||||
const artifactClient = create()
|
|
||||||
const options: UploadArtifactOptions = {}
|
const options: UploadArtifactOptions = {}
|
||||||
if (inputs.retentionDays) {
|
if (inputs.retentionDays) {
|
||||||
options.retentionDays = inputs.retentionDays
|
options.retentionDays = inputs.retentionDays
|
||||||
@@ -50,24 +48,18 @@ async function run(): Promise<void> {
|
|||||||
options.compressionLevel = inputs.compressionLevel
|
options.compressionLevel = inputs.compressionLevel
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadResponse = await artifactClient.uploadArtifact(
|
const uploadResponse = await artifact.uploadArtifact(
|
||||||
inputs.artifactName,
|
inputs.artifactName,
|
||||||
searchResult.filesToUpload,
|
searchResult.filesToUpload,
|
||||||
searchResult.rootDirectory,
|
searchResult.rootDirectory,
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
|
|
||||||
if (uploadResponse.success === false) {
|
|
||||||
core.setFailed(
|
|
||||||
`An error was encountered when uploading ${inputs.artifactName}.`
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
core.info(
|
core.info(
|
||||||
`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`
|
`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.setOutput('artifact-id', uploadResponse.id)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed((error as Error).message)
|
core.setFailed((error as Error).message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user