mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-12 14:28:09 +02:00
Update publish script to create gh-pages branch if it does not exist
This commit is contained in:
parent
120678be05
commit
1f1d1448b2
1 changed files with 14 additions and 8 deletions
|
@ -56,17 +56,23 @@ if (
|
|||
|
||||
shell.cd(`${CIRCLE_PROJECT_REPONAME}-gh-pages`);
|
||||
|
||||
if (
|
||||
shell.exec("git checkout origin/gh-pages").code +
|
||||
if (shell.exec("git checkout origin/gh-pages").code !== 0) {
|
||||
if (shell.exec("git checkout --orphan gh-pages").code !== 0) {
|
||||
shell.echo("Error: Git checkout gh-pages failed");
|
||||
shell.exit(1);
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
shell.exec("git checkout -b gh-pages").code +
|
||||
shell.exec("git branch --set-upstream-to=origin/gh-pages").code !==
|
||||
0
|
||||
) {
|
||||
shell.echo("Error: Git checkout gh-pages failed");
|
||||
shell.exit(1);
|
||||
shell.exec("git branch --set-upstream-to=origin/gh-pages").code !==
|
||||
0
|
||||
) {
|
||||
shell.echo("Error: Git checkout gh-pages failed");
|
||||
shell.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
shell.exec("rm -rf *");
|
||||
shell.exec("git rm -rf .");
|
||||
|
||||
shell.cd("../..");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue