Skip to content

Commit

Permalink
fix(nx-ghpages): deploy executor should work
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Jun 20, 2021
1 parent 621627d commit 7d29f24
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/nx-ghpages/src/executors/deploy/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,19 @@ export default async function deployExecutor(options: BuildExecutorSchema) {
});
}

await exec(
`git add . && git commit -m "deploy to gh-pages (nx-ghpages)" && git push --set-upstream ${options.remoteName} gh-pages`,
{ cwd: directory },
);

return {
success: true,
};
await exec(`git add .`, { cwd: directory });
await exec(` git commit -m "deploy to gh-pages (nx-ghpages)"`, {
cwd: directory,
});
try {
await exec(`git checkout -b gh-pages`, { cwd: directory });
} catch {
console.warn('Resetting gh-pages branch, as it already exists.');
await exec(`git checkout -B gh-pages`, { cwd: directory });
}
await exec(`git push -f --set-upstream ${options.remoteName} gh-pages`, {
cwd: directory,
});
}

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

0 comments on commit 7d29f24

Please sign in to comment.