diff --git a/dist/attachReleaseAssets/index.js b/dist/attachReleaseAssets/index.js index d47c595a..9d6b6e7d 100644 --- a/dist/attachReleaseAssets/index.js +++ b/dist/attachReleaseAssets/index.js @@ -23959,6 +23959,7 @@ exports.SYFT_VERSION = core.getInput("syft-version") || SyftVersion_1.VERSION; const PRIOR_ARTIFACT_ENV_VAR = "ANCHORE_SBOM_ACTION_PRIOR_ARTIFACT"; const tempDir = fs.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "sbom-action-")); const githubDependencySnapshotFile = `${tempDir}/github.sbom.json`; +const exeSuffix = process.platform == "win32" ? ".exe" : ""; /** * Tries to get a unique artifact name or otherwise as appropriate as possible */ @@ -24111,11 +24112,7 @@ function downloadSyft() { // Make sure the tool's executable bit is set const syftBinaryPath = `${installPath}_${name}`; yield (0, Executor_1.execute)("sh", [installPath, "-d", "-b", syftBinaryPath, version]); - const installedPath = path_1.default.join(`${syftBinaryPath}`, `${name}`); - if (process.platform === "win32") { - return `${installedPath}.exe`; - } - return installedPath; + return path_1.default.join(syftBinaryPath, name) + exeSuffix; }); } exports.downloadSyft = downloadSyft; @@ -24124,7 +24121,7 @@ exports.downloadSyft = downloadSyft; */ function getSyftCommand() { return __awaiter(this, void 0, void 0, function* () { - const name = exports.SYFT_BINARY_NAME + (process.platform == "win32" ? ".exe" : ""); + const name = exports.SYFT_BINARY_NAME + exeSuffix; const version = exports.SYFT_VERSION; const sourceSyft = yield (0, SyftDownloader_1.downloadSyftFromZip)(version); if (sourceSyft) { diff --git a/dist/downloadSyft/index.js b/dist/downloadSyft/index.js index 8aff83f9..67ece520 100644 --- a/dist/downloadSyft/index.js +++ b/dist/downloadSyft/index.js @@ -24007,6 +24007,7 @@ exports.SYFT_VERSION = core.getInput("syft-version") || SyftVersion_1.VERSION; const PRIOR_ARTIFACT_ENV_VAR = "ANCHORE_SBOM_ACTION_PRIOR_ARTIFACT"; const tempDir = fs.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "sbom-action-")); const githubDependencySnapshotFile = `${tempDir}/github.sbom.json`; +const exeSuffix = process.platform == "win32" ? ".exe" : ""; /** * Tries to get a unique artifact name or otherwise as appropriate as possible */ @@ -24159,11 +24160,7 @@ function downloadSyft() { // Make sure the tool's executable bit is set const syftBinaryPath = `${installPath}_${name}`; yield (0, Executor_1.execute)("sh", [installPath, "-d", "-b", syftBinaryPath, version]); - const installedPath = path_1.default.join(`${syftBinaryPath}`, `${name}`); - if (process.platform === "win32") { - return `${installedPath}.exe`; - } - return installedPath; + return path_1.default.join(syftBinaryPath, name) + exeSuffix; }); } exports.downloadSyft = downloadSyft; @@ -24172,7 +24169,7 @@ exports.downloadSyft = downloadSyft; */ function getSyftCommand() { return __awaiter(this, void 0, void 0, function* () { - const name = exports.SYFT_BINARY_NAME + (process.platform == "win32" ? ".exe" : ""); + const name = exports.SYFT_BINARY_NAME + exeSuffix; const version = exports.SYFT_VERSION; const sourceSyft = yield (0, SyftDownloader_1.downloadSyftFromZip)(version); if (sourceSyft) { diff --git a/dist/runSyftAction/index.js b/dist/runSyftAction/index.js index f5d840ff..5ec6e85f 100644 --- a/dist/runSyftAction/index.js +++ b/dist/runSyftAction/index.js @@ -23959,6 +23959,7 @@ exports.SYFT_VERSION = core.getInput("syft-version") || SyftVersion_1.VERSION; const PRIOR_ARTIFACT_ENV_VAR = "ANCHORE_SBOM_ACTION_PRIOR_ARTIFACT"; const tempDir = fs.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "sbom-action-")); const githubDependencySnapshotFile = `${tempDir}/github.sbom.json`; +const exeSuffix = process.platform == "win32" ? ".exe" : ""; /** * Tries to get a unique artifact name or otherwise as appropriate as possible */ @@ -24111,11 +24112,7 @@ function downloadSyft() { // Make sure the tool's executable bit is set const syftBinaryPath = `${installPath}_${name}`; yield (0, Executor_1.execute)("sh", [installPath, "-d", "-b", syftBinaryPath, version]); - const installedPath = path_1.default.join(`${syftBinaryPath}`, `${name}`); - if (process.platform === "win32") { - return `${installedPath}.exe`; - } - return installedPath; + return path_1.default.join(syftBinaryPath, name) + exeSuffix; }); } exports.downloadSyft = downloadSyft; @@ -24124,7 +24121,7 @@ exports.downloadSyft = downloadSyft; */ function getSyftCommand() { return __awaiter(this, void 0, void 0, function* () { - const name = exports.SYFT_BINARY_NAME + (process.platform == "win32" ? ".exe" : ""); + const name = exports.SYFT_BINARY_NAME + exeSuffix; const version = exports.SYFT_VERSION; const sourceSyft = yield (0, SyftDownloader_1.downloadSyftFromZip)(version); if (sourceSyft) { diff --git a/src/github/SyftGithubAction.ts b/src/github/SyftGithubAction.ts index 60e15daf..4cc89cd2 100644 --- a/src/github/SyftGithubAction.ts +++ b/src/github/SyftGithubAction.ts @@ -30,6 +30,8 @@ const PRIOR_ARTIFACT_ENV_VAR = "ANCHORE_SBOM_ACTION_PRIOR_ARTIFACT"; const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "sbom-action-")); const githubDependencySnapshotFile = `${tempDir}/github.sbom.json`; +const exeSuffix = process.platform == "win32" ? ".exe" : ""; + /** * Tries to get a unique artifact name or otherwise as appropriate as possible */ @@ -205,18 +207,14 @@ export async function downloadSyft(): Promise { await execute("sh", [installPath, "-d", "-b", syftBinaryPath, version]); - const installedPath = path.join(`${syftBinaryPath}`, `${name}`); - if (process.platform === "win32") { - return `${installedPath}.exe`; - } - return installedPath; + return path.join(syftBinaryPath, name) + exeSuffix; } /** * Gets the Syft command to run via exec */ export async function getSyftCommand(): Promise { - const name = SYFT_BINARY_NAME + (process.platform == "win32" ? ".exe" : ""); + const name = SYFT_BINARY_NAME + exeSuffix; const version = SYFT_VERSION; const sourceSyft = await downloadSyftFromZip(version);