Skip to content

Commit

Permalink
Wrap in promise and refactor end
Browse files Browse the repository at this point in the history
  • Loading branch information
andershagbard committed Jul 12, 2023
1 parent 61cf3e1 commit 98b0297
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/actions/parts/create-zip-from-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ import path from 'path';
import { BUILD_DIR } from '../../inputs';

export default async (): Promise<string> => {
core.info(`Creating zip file from directory "${BUILD_DIR}"`);
return new Promise(async (resolve) => {
core.info(`Creating zip file from directory "${BUILD_DIR}"`);

const zip = fs.createWriteStream('build.zip');
const archive = archiver('zip', { zlib: { level: 9 } });
archive.pipe(zip);
const zip = fs.createWriteStream('build.zip');
const archive = archiver('zip', { zlib: { level: 9 } });
archive.pipe(zip);

archive.directory(BUILD_DIR, false);
await archive.finalize();
zip.on('close', () => {
resolve(path.resolve('build.zip'));
});

return path.resolve('build.zip');
archive.directory(BUILD_DIR, false);
await archive.finalize();
});
};

0 comments on commit 98b0297

Please sign in to comment.