mirror of
https://github.com/papeloto/action-zip
synced 2024-11-25 22:58:25 -08:00
fix: dir path zipping
This commit is contained in:
parent
579632f552
commit
ed1eb3211d
2 changed files with 8 additions and 8 deletions
8
dist/index.js
vendored
8
dist/index.js
vendored
|
@ -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);
|
||||
|
||||
|
|
8
index.js
8
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);
|
||||
|
|
Loading…
Reference in a new issue