feat: run CMake build from the JavaScript Action (#75)

* feat: add CMake build step

* feat: only run CMake build step if `run-build` input is true

* feat: pass `build-args` input to the CMake build command

* fix: split lines from `getMultilineInput` with a whitespace
This commit is contained in:
Alfi Maulana 2023-11-20 20:51:25 +07:00 committed by GitHub
parent 48cb08d783
commit 421f12e1db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

6
main/index.mjs generated
View File

@ -27245,6 +27245,12 @@ async function main() {
const buildDir = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput("build-dir");
await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec("cmake", [sourceDir || ".", "-B", buildDir || "build"]);
_actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput("build-dir", buildDir || "build");
const runBuild = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getBooleanInput("run-build");
if (runBuild) {
const buildArgs = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getMultilineInput("build-args")
.flatMap((args) => args.split(" "));
await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec("cmake", ["--build", buildDir || "build", ...buildArgs]);
}
}
main();
//# sourceMappingURL=main.mjs.map

View File

@ -6,6 +6,14 @@ async function main() {
const buildDir = core.getInput("build-dir");
await exec.exec("cmake", [sourceDir || ".", "-B", buildDir || "build"]);
core.setOutput("build-dir", buildDir || "build");
const runBuild = core.getBooleanInput("run-build");
if (runBuild) {
const buildArgs = core
.getMultilineInput("build-args")
.flatMap((args) => args.split(" "));
await exec.exec("cmake", ["--build", buildDir || "build", ...buildArgs]);
}
}
main();