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,27 +17,29 @@ 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);
await exec.exec('rsync', [ core.debug(`${files}`);
'-rptgoDv', for await (const file of files) {
'--copy-links', if (file.endsWith('.git') || file.endsWith('.github')) {
'--copy-dirlinks', continue;
"--exclude='.git'", }
"--exclude='.github'", const filePath = path.join(publishDir, file);
`${publishDir}/`, await io.cp(filePath, `${workDir}/`, copyOpts);
`${workDir}/` core.info(`[INFO] copy ${file}`);
]); }
// for await (const file of files) { } else {
// if (file.endsWith('.git') || file.endsWith('.github')) { await exec.exec('rsync', [
// continue; '-rptgoDv',
// } '--copy-links',
// const filePath = path.join(publishDir, file); '--copy-dirlinks',
// await io.cp(filePath, `${workDir}/`, copyOpts); "--exclude='.git'",
// core.info(`[INFO] copy ${file}`); "--exclude='.github'",
// } `${publishDir}/`,
`${workDir}/`
]);
}
return; return;
} }