gradle-build-action/src/execution.ts

18 lines
614 B
TypeScript
Raw Normal View History

import * as core from '@actions/core'
2020-06-13 11:44:30 +00:00
import * as exec from '@actions/exec'
import * as gradlew from './gradlew'
2019-09-21 14:01:53 +00:00
export async function executeGradleBuild(executable: string | undefined, root: string, args: string[]): Promise<void> {
// Use the provided executable, or look for a Gradle wrapper script to run
const toExecute = executable ?? gradlew.gradleWrapperScript(root)
const status: number = await exec.exec(toExecute, args, {
2019-09-21 14:01:53 +00:00
cwd: root,
ignoreReturnCode: true
2020-06-13 11:44:30 +00:00
})
2019-09-21 14:01:53 +00:00
if (status !== 0) {
core.setFailed(`Gradle build failed: see console output for details`)
}
2019-09-21 14:01:53 +00:00
}