From 109ec16cefcbbd89e01cbbedf59eb6f1e783aebb Mon Sep 17 00:00:00 2001 From: Manas Jayanth <3097018+ManasJayanth@users.noreply.github.com> Date: Sat, 27 Jul 2024 07:01:01 +0530 Subject: [PATCH] Fixes working directory while npm-release --- dist/index.js | 11 +++++------ index.ts | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dist/index.js b/dist/index.js index e912acc..97d442a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -141353,6 +141353,10 @@ if (partsSeparatedBtAT.length > 1 && partsSeparatedBtAT[0] !== "") { console.error("Please specify the version (or NPM dist-tag) in the setup-esy-version field"); process.exit(-1); } +let workingDirectory = core.getInput("working-directory") || process.cwd(); +workingDirectory = external_path_.isAbsolute(workingDirectory) + ? workingDirectory + : external_path_.join(process.cwd(), workingDirectory); function run(name, command, args) { return __awaiter(this, void 0, void 0, function* () { const PATH = process.env.PATH ? process.env.PATH : ""; @@ -141418,10 +141422,6 @@ const index_platform = external_os_.platform(); const arch = external_os_.arch(); function main() { return __awaiter(this, void 0, void 0, function* () { - let workingDirectory = core.getInput("working-directory") || process.cwd(); - workingDirectory = external_path_.isAbsolute(workingDirectory) - ? workingDirectory - : external_path_.join(process.cwd(), workingDirectory); // Otherwise, when we change directories and then back (workingDirectory -> /tmp -> workingDirectory) // chdir() would try to enter a path relative to that path try { @@ -141551,7 +141551,7 @@ function prepareNPMArtifacts() { yield runEsyCommand("Running esy npm-release", ["npm-release"]); } let tarFile = `npm-tarball.tgz`; - yield compress("_release", tarFile); + yield compress(external_path_.join(workingDirectory, "_release"), tarFile); const artifactName = `esy-npm-release-${index_platform}-${arch}`; console.log("Artifact name: ", artifactName); const { id, size } = yield artifact_default().uploadArtifact(artifactName, [tarFile], process.env.GITHUB_WORKSPACE, { @@ -141579,7 +141579,6 @@ function prepareNPMArtifacts() { } function bundleNPMArtifacts() { return __awaiter(this, void 0, void 0, function* () { - const workingDirectory = core.getInput("working-directory") || process.cwd(); external_fs_.statSync(workingDirectory); process.chdir(workingDirectory); const releaseFolder = external_path_.join(workingDirectory, "_npm-release"); diff --git a/index.ts b/index.ts index 1f5281a..c6c9366 100644 --- a/index.ts +++ b/index.ts @@ -48,6 +48,10 @@ if (partsSeparatedBtAT.length > 1 && partsSeparatedBtAT[0] !== "") { ); process.exit(-1); } +let workingDirectory = core.getInput("working-directory") || process.cwd(); +workingDirectory = path.isAbsolute(workingDirectory) + ? workingDirectory + : path.join(process.cwd(), workingDirectory); async function run(name: string, command: string, args: string[]) { const PATH = process.env.PATH ? process.env.PATH : ""; @@ -128,10 +132,6 @@ function computeChecksum(filePath: string, algo: string) { const platform = os.platform(); const arch = os.arch(); async function main() { - let workingDirectory = core.getInput("working-directory") || process.cwd(); - workingDirectory = path.isAbsolute(workingDirectory) - ? workingDirectory - : path.join(process.cwd(), workingDirectory); // Otherwise, when we change directories and then back (workingDirectory -> /tmp -> workingDirectory) // chdir() would try to enter a path relative to that path try { @@ -295,7 +295,7 @@ async function prepareNPMArtifacts() { await runEsyCommand("Running esy npm-release", ["npm-release"]); } let tarFile = `npm-tarball.tgz`; - await compress("_release", tarFile); + await compress(path.join(workingDirectory, "_release"), tarFile); const artifactName = `esy-npm-release-${platform}-${arch}`; console.log("Artifact name: ", artifactName); @@ -327,7 +327,6 @@ async function prepareNPMArtifacts() { } async function bundleNPMArtifacts() { - const workingDirectory = core.getInput("working-directory") || process.cwd(); fs.statSync(workingDirectory); process.chdir(workingDirectory); const releaseFolder = path.join(workingDirectory, "_npm-release");