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

Fix for ESM

This commit is contained in:
Minionguyjpro
2025-08-21 21:48:18 +02:00
parent 73338b7159
commit e03934be3e

View File

@@ -1,34 +1,10 @@
const core = require("@actions/core"); import * as core from "@actions/core";
const { promises: fs } = require("fs"); import { promises as fs } from "fs";
const { exec, execFile } = require("child_process"); import { exec, execFile } from "child_process";
import { promisify } from "util";
function execPromise(command) { const execPromise = promisify(exec);
return new Promise((resolve, reject) => { const execFilePromise = promisify(execFile);
exec(command, (error, stdout, stderr) => {
console.log(stdout);
console.error(stderr);
if (error) {
reject(new Error(`Command failed: ${stderr}`));
} else {
resolve(stdout);
}
});
});
}
function execFilePromise(file, args) {
return new Promise((resolve, reject) => {
execFile(file, args, (error, stdout, stderr) => {
console.log(stdout);
console.error(stderr);
if (error) {
reject(new Error(`Execution failed: ${stderr}`));
} else {
resolve(stdout);
}
});
});
}
const workspacePath = process.env.GITHUB_WORKSPACE; const workspacePath = process.env.GITHUB_WORKSPACE;
const options = core.getMultilineInput("options"); const options = core.getMultilineInput("options");
@@ -60,14 +36,30 @@ async function run() {
const escapedOptions = options.map((str) => str.replace(/(["'])/g, "$1")); const escapedOptions = options.map((str) => str.replace(/(["'])/g, "$1"));
// Install Inno Setup silently // Install Inno Setup silently
await execPromise( try {
const { stdout, stderr } = await execPromise(
`winget install --id JRSoftware.InnoSetup -e -s winget -h` `winget install --id JRSoftware.InnoSetup -e -s winget -h`
); );
console.log(stdout);
console.error(stderr);
} catch (err) {
throw new Error(`Failed to install Inno Setup: ${err.stderr || err.message}`);
}
// Run Inno Setup Compiler
const isccPath = `${process.env["ProgramFiles(x86)"]}\\Inno Setup 6\\iscc.exe`; const isccPath = `${process.env["ProgramFiles(x86)"]}\\Inno Setup 6\\iscc.exe`;
const scriptPath = `${workspacePath}\\${path}`; const scriptPath = `${workspacePath}\\${path}`;
await execFilePromise(isccPath, [...escapedOptions, scriptPath]); try {
const { stdout, stderr } = await execFilePromise(isccPath, [
...escapedOptions,
scriptPath,
]);
console.log(stdout);
console.error(stderr);
} catch (err) {
throw new Error(`Execution failed: ${err.stderr || err.message}`);
}
console.log("Inno Setup script compiled successfully."); console.log("Inno Setup script compiled successfully.");
} catch (error) { } catch (error) {