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, publishDir: string,
workDir: string workDir: string
): Promise<void> { ): Promise<void> {
// const copyOpts = {recursive: true, force: true}; if (process.platform === 'win32') {
// const files = fs.readdirSync(publishDir); const copyOpts = {recursive: true, force: true};
// core.debug(`${files}`); 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', [ await exec.exec('rsync', [
'-rptgoDv', '-rptgoDv',
'--copy-links', '--copy-links',
@ -29,15 +39,7 @@ export async function copyAssets(
`${publishDir}/`, `${publishDir}/`,
`${workDir}/` `${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; return;
} }