1
0
mirror of https://github.com/Minionguyjpro/Inno-Setup-Action synced 2026-02-18 17:41:18 +01:00

[AUTO]Update CJS script

Files changed:
M	dist/index.js
M	src/index.js
This commit is contained in:
github-actions[bot]
2024-10-12 17:28:14 +00:00
parent 9365f5270a
commit 4dc352970d
2 changed files with 44 additions and 46 deletions

68
dist/index.js vendored
View File

@@ -27305,62 +27305,58 @@ module.exports = parseParams
/******/ /******/
/************************************************************************/ /************************************************************************/
var __webpack_exports__ = {}; var __webpack_exports__ = {};
// Importing necessary modules
const core = __nccwpck_require__(7484); const core = __nccwpck_require__(7484);
const fs = __nccwpck_require__(9896); const fs = (__nccwpck_require__(9896).promises);
const { execFile } = __nccwpck_require__(5317);
// Getting the path to the workspace from environment variables
const workspacePath = process.env.GITHUB_WORKSPACE; const workspacePath = process.env.GITHUB_WORKSPACE;
// Getting inputs from the workflow
const options = core.getInput("options"); const options = core.getInput("options");
const path = core.getInput("path"); const path = core.getInput("path");
// Importing the child_process module for executing shell commands
const exec = (__nccwpck_require__(5317).exec);
// Initializing error variables
let repoError; let repoError;
let platformError; let platformError;
// Checking if the platform is Windows async function run() {
if (process.platform === "win32") { try {
// Checking if the GitHub workspace exists and is not empty if (process.platform === "win32") {
if ( let workspaceExists;
fs.existsSync(process.env.GITHUB_WORKSPACE) && try {
fs.readdirSync(workspacePath).length > 0 await fs.access(workspacePath);
) { workspaceExists = true;
// Building and executing the Inno Setup compiler command } catch {
exec( workspaceExists = false;
`"%PROGRAMFILES(X86)%\\Inno Setup 6\\iscc.exe" ${options} "${workspacePath}\\${path}"`, }
{ stdio: "ignore" },
function (execError, stdout, stderr) {
// Logging the standard output of the command
console.log(stdout);
// Handling errors, if any const workspaceNotEmpty = (await fs.readdir(workspacePath)).length > 0;
if (workspaceExists && workspaceNotEmpty) {
execFile(
`${process.env["ProgramFiles(x86)"]}\\Inno Setup 6\\iscc.exe`,
[options, `${workspacePath}\\${path}`],
(execError, stdout, stderr) => {
console.log(stdout);
if (execError) { if (execError) {
repoError = { code: execError.code || 1 }; core.setFailed(`Execution failed with error: ${stderr}`);
core.setFailed(stderr); process.exit(execError.code || 1);
process.exit(repoError.code);
} }
}, },
); );
} else { } else {
// Setting an error code and failing the workflow if the repository is not cloned throw new Error(
repoError = { code: 1 };
core.setFailed(
"The repository was not cloned. Please specify the actions/checkout action before this step.", "The repository was not cloned. Please specify the actions/checkout action before this step.",
); );
process.exit(repoError.code);
} }
} else { } else {
// Setting an error code and failing the workflow if the platform is not Windows throw new Error("This action is only supported on Windows!");
platformError = { code: 1 }; }
core.setFailed("This action is only supported on Windows!"); } catch (error) {
process.exit(platformError.code); core.setFailed(error.message);
process.exit(1);
}
} }
run();
module.exports = __webpack_exports__; module.exports = __webpack_exports__;
/******/ })() /******/ })()
; ;

View File

@@ -32,10 +32,12 @@ async function run() {
core.setFailed(`Execution failed with error: ${stderr}`); core.setFailed(`Execution failed with error: ${stderr}`);
process.exit(execError.code || 1); process.exit(execError.code || 1);
} }
} },
); );
} else { } else {
throw new Error("The repository was not cloned. Please specify the actions/checkout action before this step."); throw new Error(
"The repository was not cloned. Please specify the actions/checkout action before this step.",
);
} }
} else { } else {
throw new Error("This action is only supported on Windows!"); throw new Error("This action is only supported on Windows!");