File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
packages/nx-ghpages/src/executors/deploy Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -40,14 +40,19 @@ export default async function deployExecutor(options: BuildExecutorSchema) {
4040 } ) ;
4141 }
4242
43- await exec (
44- `git add . && git commit -m "deploy to gh-pages (nx-ghpages)" && git push --set-upstream ${ options . remoteName } gh-pages` ,
45- { cwd : directory } ,
46- ) ;
47-
48- return {
49- success : true ,
50- } ;
43+ await exec ( `git add .` , { cwd : directory } ) ;
44+ await exec ( ` git commit -m "deploy to gh-pages (nx-ghpages)"` , {
45+ cwd : directory ,
46+ } ) ;
47+ try {
48+ await exec ( `git checkout -b gh-pages` , { cwd : directory } ) ;
49+ } catch {
50+ console . warn ( 'Resetting gh-pages branch, as it already exists.' ) ;
51+ await exec ( `git checkout -B gh-pages` , { cwd : directory } ) ;
52+ }
53+ await exec ( `git push -f --set-upstream ${ options . remoteName } gh-pages` , {
54+ cwd : directory ,
55+ } ) ;
5156}
5257
5358async function findWorkspaceRoot ( dir : string = process . cwd ( ) ) : Promise < string > {
You can’t perform that action at this time.
0 commit comments