Skip to content

Commit

Permalink
Fixes working directory while npm-release
Browse files Browse the repository at this point in the history
  • Loading branch information
ManasJayanth committed Jul 27, 2024
1 parent 9a600a1 commit 109ec16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 : "";
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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");
Expand Down
11 changes: 5 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 : "";
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 109ec16

Please sign in to comment.