35 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-06-13 13:44:30 +02:00
import * as core from '@actions/core'
2019-09-21 16:01:53 +02:00
import * as setupGradle from './setup-gradle'
2020-06-13 13:44:30 +02:00
import * as execution from './execution'
import * as provisioner from './provision'
import * as layout from './repository-layout'
import * as params from './input-params'
2019-09-21 16:01:53 +02:00
/**
* The main entry point for the action, called by Github Actions for the step.
*/
2020-06-13 13:54:27 +02:00
export async function run(): Promise<void> {
try {
// Configure Gradle environment (Gradle User Home)
await setupGradle.setup()
// Download and install Gradle if required
const executable = await provisioner.provisionGradle()
2019-09-21 16:01:53 +02:00
// Only execute if arguments have been provided
const args: string[] = params.getArguments()
if (args.length > 0) {
const buildRootDirectory = layout.buildRootDirectory()
await execution.executeGradleBuild(executable, buildRootDirectory, args)
2019-09-23 12:11:18 +02:00
}
2019-09-21 16:01:53 +02:00
} catch (error) {
core.setFailed(String(error))
if (error instanceof Error && error.stack) {
core.info(error.stack)
}
2019-09-21 16:01:53 +02:00
}
2019-09-20 23:06:59 +02:00
}
2020-06-13 13:44:30 +02:00
run()