Skip to content

Commit

Permalink
Merge pull request #1 from christopherfrieler/bugfix/failed-build-art…
Browse files Browse the repository at this point in the history
…ifacts

upload artifacts on failed gradle-executions as well
  • Loading branch information
christopherfrieler authored Apr 7, 2021
2 parents 72bface + 5d1faea commit 30063a3
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@ async function run() {

await exec.exec('chmod +x gradlew');

const gradleArguments = core.getInput('arguments', { required: true }).replace(/\n/g, " ");
await exec.exec(`./gradlew --no-daemon --stacktrace ${gradleArguments}`);

const artifacts = core.getInput("artifacts")
if (artifacts) {
const artifactClient = artifact.create()
const artifactUploadOptions = {
continueOnError: false
}
for (const artifact of artifacts.split("\n")) {
const artifactDeclaration = artifact.split(" ", 2);
const artifactName = artifactDeclaration[0];
const artifactPathGlobber = await glob.create(artifactDeclaration[1]);
const artifactPath = await artifactPathGlobber.glob()
await artifactClient.uploadArtifact(artifactName, artifactPath, '.', artifactUploadOptions)
try {
const gradleArguments = core.getInput('arguments', { required: true }).replace(/\n/g, " ");
await exec.exec(`./gradlew --no-daemon --stacktrace ${gradleArguments}`);
} finally {
const artifacts = core.getInput("artifacts")
if (artifacts) {
const artifactClient = artifact.create()
const artifactUploadOptions = {
continueOnError: false
}
for (const artifact of artifacts.split("\n")) {
const artifactDeclaration = artifact.split(" ", 2);
const artifactName = artifactDeclaration[0];
const artifactPathGlobber = await glob.create(artifactDeclaration[1]);
const artifactPath = await artifactPathGlobber.glob()
await artifactClient.uploadArtifact(artifactName, artifactPath, '.', artifactUploadOptions)
}
}
}

Expand Down

0 comments on commit 30063a3

Please sign in to comment.