Update publish script to create gh-pages branch if it does not exist

This commit is contained in:
Frank Li 2017-08-16 17:36:00 -07:00
parent 120678be05
commit 1f1d1448b2

View file

@ -56,8 +56,13 @@ if (
shell.cd(`${CIRCLE_PROJECT_REPONAME}-gh-pages`); shell.cd(`${CIRCLE_PROJECT_REPONAME}-gh-pages`);
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 ( if (
shell.exec("git checkout origin/gh-pages").code +
shell.exec("git checkout -b gh-pages").code + shell.exec("git checkout -b gh-pages").code +
shell.exec("git branch --set-upstream-to=origin/gh-pages").code !== shell.exec("git branch --set-upstream-to=origin/gh-pages").code !==
0 0
@ -65,8 +70,9 @@ if (
shell.echo("Error: Git checkout gh-pages failed"); shell.echo("Error: Git checkout gh-pages failed");
shell.exit(1); shell.exit(1);
} }
}
shell.exec("rm -rf *"); shell.exec("git rm -rf .");
shell.cd("../.."); shell.cd("../..");