From 46146058b69b014134a7d788299d643e83cc3176 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Sat, 7 Mar 2020 06:19:48 +0900 Subject: [PATCH] fix: Use io.cp() on windows --- src/git-utils.ts | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/git-utils.ts b/src/git-utils.ts index 00519e0..d0c8c13 100644 --- a/src/git-utils.ts +++ b/src/git-utils.ts @@ -17,27 +17,29 @@ export async function copyAssets( publishDir: string, workDir: string ): Promise { - // const copyOpts = {recursive: true, force: true}; - // const files = fs.readdirSync(publishDir); - // core.debug(`${files}`); - await exec.exec('rsync', [ - '-rptgoDv', - '--copy-links', - '--copy-dirlinks', - "--exclude='.git'", - "--exclude='.github'", - `${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}`); - // } - + 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', + '--copy-dirlinks', + "--exclude='.git'", + "--exclude='.github'", + `${publishDir}/`, + `${workDir}/` + ]); + } return; }