mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-05 05:07:14 +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
|
@ -63,6 +63,9 @@ jobs:
|
||||||
git config --global user.name "Website Deployment Script"
|
git config --global user.name "Website Deployment Script"
|
||||||
echo "machine github.com login facebook-github-bot" > ~/.netrc
|
echo "machine github.com login facebook-github-bot" > ~/.netrc
|
||||||
fi
|
fi
|
||||||
|
- run:
|
||||||
|
name: Install Dependencies
|
||||||
|
command: sudo apt install rsync
|
||||||
- run:
|
- run:
|
||||||
name: Deploy Website
|
name: Deploy Website
|
||||||
command: |
|
command: |
|
||||||
|
|
|
@ -118,9 +118,14 @@ excludePath = `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`;
|
||||||
// cannot use shell.cp because it doesn't support copying dotfiles and we
|
// cannot use shell.cp because it doesn't support copying dotfiles and we
|
||||||
// need to copy directories like .circleci, for example
|
// need to copy directories like .circleci, for example
|
||||||
// https://github.com/shelljs/shelljs/issues/79
|
// https://github.com/shelljs/shelljs/issues/79
|
||||||
shell.exec(
|
if (
|
||||||
`rsync -rt --exclude=${excludePath} --exclude=.DS_Store ${fromPath} ${toPath}`
|
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}`));
|
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 add --all');
|
||||||
|
|
||||||
shell.exec(
|
if (
|
||||||
`git commit -m "Deploy website" -m "Deploy website version based on ${
|
shell.exec(
|
||||||
currentCommit
|
`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) {
|
if (shell.exec(`git push origin ${DEPLOYMENT_BRANCH}`).code !== 0) {
|
||||||
shell.echo('Error: Git push failed');
|
shell.echo('Error: Git push failed');
|
||||||
shell.exit(1);
|
shell.exit(1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue