mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 20:57:17 +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"
|
||||
echo "machine github.com login facebook-github-bot" > ~/.netrc
|
||||
fi
|
||||
- run:
|
||||
name: Install Dependencies
|
||||
command: sudo apt install rsync
|
||||
- run:
|
||||
name: Deploy Website
|
||||
command: |
|
||||
|
|
|
@ -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
Reference in a new issue