mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 08:37:25 +02:00
Guard against errors during the deploy step, and install rsync (#277)
This commit is contained in:
parent
ea5a11bcd0
commit
cf89dacaf6
2 changed files with 21 additions and 8 deletions
|
@ -118,9 +118,14 @@ excludePath = `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`;
|
|||
// cannot use shell.cp because it doesn't support copying dotfiles and we
|
||||
// need to copy directories like .circleci, for example
|
||||
// https://github.com/shelljs/shelljs/issues/79
|
||||
shell.exec(
|
||||
`rsync -rt --exclude=${excludePath} --exclude=.DS_Store ${fromPath} ${toPath}`
|
||||
);
|
||||
if (
|
||||
shell.exec(
|
||||
`rsync -rt --exclude=${excludePath} --exclude=.DS_Store ${fromPath} ${toPath}`
|
||||
).code !== 0
|
||||
) {
|
||||
shell.echo(`Error: Copying build assets failed`);
|
||||
shell.exit(1);
|
||||
}
|
||||
|
||||
shell.cd(path.join('build', `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`));
|
||||
|
||||
|
@ -128,11 +133,16 @@ const currentCommit = shell.exec('git rev-parse HEAD').stdout.trim();
|
|||
|
||||
shell.exec('git add --all');
|
||||
|
||||
shell.exec(
|
||||
`git commit -m "Deploy website" -m "Deploy website version based on ${
|
||||
currentCommit
|
||||
}"`
|
||||
);
|
||||
if (
|
||||
shell.exec(
|
||||
`git commit -m "Deploy website" -m "Deploy website version based on ${
|
||||
currentCommit
|
||||
}"`
|
||||
).code !== 0
|
||||
) {
|
||||
shell.echo(`Error: Committing static website failed`);
|
||||
shell.exit(1);
|
||||
}
|
||||
if (shell.exec(`git push origin ${DEPLOYMENT_BRANCH}`).code !== 0) {
|
||||
shell.echo('Error: Git push failed');
|
||||
shell.exit(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue