Skip to content

Commit 7d29f24

Browse files
author
Craigory Coppola
committed
fix(nx-ghpages): deploy executor should work
1 parent 621627d commit 7d29f24

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

packages/nx-ghpages/src/executors/deploy/executor.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff 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

5358
async function findWorkspaceRoot(dir: string = process.cwd()): Promise<string> {

0 commit comments

Comments
 (0)