From ed1eb3211dbf25402be766cabcf1ac5b0ddb3fe5 Mon Sep 17 00:00:00 2001 From: papeloto Date: Sat, 21 Mar 2020 13:33:59 +0100 Subject: [PATCH] fix: dir path zipping --- dist/index.js | 8 ++++---- index.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index d2fd017..1b2ab6d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -76,13 +76,13 @@ files.split(" ").forEach(fileName => { const dir = path.dirname(fileName); const stats = fs.lstatSync(filePath); - console.log(`dir: ${dir}`); - console.log(`Is dir: ${stats.isDirectory()}`); console.log(`filePath: ${filePath}`); console.log(`fileName: ${fileName}`); + console.log(`dir: ${dir}`); + console.log(`Is dir: ${stats.isDirectory()}`); if (stats.isDirectory()) { - zip.addLocalFolder(filePath, dir); + zip.addLocalFolder(filePath, dir === "." ? fileName : dir); } else { zip.addLocalFile(filePath, dir === "." ? "" : dir); } @@ -94,7 +94,7 @@ const destPath = path.join(process.env.GITHUB_WORKSPACE, dest); zip.writeZip(destPath); -console.log(`\nZipped file ${destPath} successfully`); +console.log(`\nZipped file ${dest} successfully`); core.setOutput(destPath); diff --git a/index.js b/index.js index b11d260..17768ef 100644 --- a/index.js +++ b/index.js @@ -21,13 +21,13 @@ files.split(" ").forEach(fileName => { const dir = path.dirname(fileName); const stats = fs.lstatSync(filePath); - console.log(`dir: ${dir}`); - console.log(`Is dir: ${stats.isDirectory()}`); console.log(`filePath: ${filePath}`); console.log(`fileName: ${fileName}`); + console.log(`dir: ${dir}`); + console.log(`Is dir: ${stats.isDirectory()}`); if (stats.isDirectory()) { - zip.addLocalFolder(filePath, dir); + zip.addLocalFolder(filePath, dir === "." ? fileName : dir); } else { zip.addLocalFile(filePath, dir === "." ? "" : dir); } @@ -39,6 +39,6 @@ const destPath = path.join(process.env.GITHUB_WORKSPACE, dest); zip.writeZip(destPath); -console.log(`\nZipped file ${destPath} successfully`); +console.log(`\nZipped file ${dest} successfully`); core.setOutput(destPath);