feat: Use rsync instead of io.cp()

This commit is contained in:
peaceiris 2020-03-06 21:10:16 +00:00
parent fab0628782
commit 5d8f5a15f7
2 changed files with 21 additions and 11 deletions

View File

@ -11,6 +11,7 @@ RUN apt-get update && \
ca-certificates \
wget \
ssh \
rsync \
vim && \
rm -rf /var/lib/apt/lists/* && \
npm i -g npm

View File

@ -17,17 +17,26 @@ export async function copyAssets(
publishDir: string,
workDir: string
): Promise<void> {
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}`);
}
// 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}`);
// }
return;
}