Skip to content

Commit

Permalink
Merge pull request #215 from Jimver/fix-artifact-upload
Browse files Browse the repository at this point in the history
Fix artifact upload
  • Loading branch information
Jimver committed Mar 18, 2023
2 parents 5a3e895 + c776944 commit 01fe5da
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
24 changes: 16 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

31 changes: 19 additions & 12 deletions src/installer.ts
@@ -1,5 +1,6 @@
import * as artifact from '@actions/artifact'
import * as core from '@actions/core'
import * as glob from '@actions/glob'
import {OSType, getOs} from './platform'
import {SemVer} from 'semver'
import {exec} from '@actions/exec'
Expand Down Expand Up @@ -64,25 +65,31 @@ export async function install(
const exitCode = await exec(command, installArgs, execOptions)
core.debug(`Installer exit code: ${exitCode}`)
} catch (error) {
core.debug(`Error during installation: ${error}`)
core.warning(`Error during installation: ${error}`)
throw error
} finally {
// Always upload installation log regardless of error
if ((await getOs()) === OSType.linux) {
const artifactClient = artifact.create()
const artifactName = 'install-log'
const files = ['/var/log/cuda-installer.log']
const rootDirectory = '/var/log'
const artifactOptions = {
continueOnError: true
const patterns = ['/var/log/cuda-installer.log']
const globber = await glob.create(patterns.join('\n'))
const files = await globber.glob()
if (files.length > 0) {
const rootDirectory = '/var/log'
const artifactOptions = {
continueOnError: true
}
const uploadResult = await artifactClient.uploadArtifact(
artifactName,
files,
rootDirectory,
artifactOptions
)
core.debug(`Upload result: ${uploadResult}`)
} else {
core.debug(`No log file to upload`)
}
const uploadResult = await artifactClient.uploadArtifact(
artifactName,
files,
rootDirectory,
artifactOptions
)
core.debug(`Upload result: ${uploadResult}`)
}
}
}

0 comments on commit 01fe5da

Please sign in to comment.