fix: Use io.cp() on windows

This commit is contained in:
peaceiris 2020-03-07 06:19:48 +09:00
parent 5d8f5a15f7
commit 46146058b6

View File

@ -17,9 +17,19 @@ export async function copyAssets(
publishDir: string,
workDir: string
): Promise<void> {
// const copyOpts = {recursive: true, force: true};
// const files = fs.readdirSync(publishDir);
// core.debug(`${files}`);
if (process.platform === 'win32') {
const copyOpts = {recursive: true, force: true};
const files = fs.readdirSync(publishDir);
core.debug(`${files}`);
for await (const file of files) {
if (file.endsWith('.git') || file.endsWith('.github')) {
continue;
}
const filePath = path.join(publishDir, file);
await io.cp(filePath, `${workDir}/`, copyOpts);
core.info(`[INFO] copy ${file}`);
}
} else {
await exec.exec('rsync', [
'-rptgoDv',
'--copy-links',
@ -29,15 +39,7 @@ export async function copyAssets(
`${publishDir}/`,
`${workDir}/`
]);
// for await (const file of files) {
// if (file.endsWith('.git') || file.endsWith('.github')) {
// continue;
// }
// const filePath = path.join(publishDir, file);
// await io.cp(filePath, `${workDir}/`, copyOpts);
// core.info(`[INFO] copy ${file}`);
// }
}
return;
}