mirror of
https://github.com/peaceiris/actions-gh-pages.git
synced 2025-07-15 06:33:17 +08:00
feat: Use rsync instead of io.cp()
This commit is contained in:
parent
fab0628782
commit
5d8f5a15f7
@ -11,6 +11,7 @@ RUN apt-get update && \
|
||||
ca-certificates \
|
||||
wget \
|
||||
ssh \
|
||||
rsync \
|
||||
vim && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
npm i -g npm
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user