diff --git a/packages/docusaurus/src/commands/deploy.ts b/packages/docusaurus/src/commands/deploy.ts index ade2c860ba..0bfb23ebe7 100644 --- a/packages/docusaurus/src/commands/deploy.ts +++ b/packages/docusaurus/src/commands/deploy.ts @@ -62,7 +62,9 @@ export async function deploy(siteDir: string): Promise { // github.io indicates organization repos that deploy via master. All others use gh-pages. const deploymentBranch = - projectName.indexOf('.github.io') !== -1 ? 'master' : 'gh-pages'; + process.env.DEPLOYMENT_BRANCH || projectName.indexOf('.github.io') !== -1 + ? 'master' + : 'gh-pages'; const githubHost = process.env.GITHUB_HOST || siteConfig.githubHost || 'github.com'; diff --git a/website/docs/deployment.md b/website/docs/deployment.md index cdd3913c28..14ffcfdab6 100644 --- a/website/docs/deployment.md +++ b/website/docs/deployment.md @@ -86,6 +86,7 @@ There are two more optional parameters that are set as environment variables: | Name | Description | | --- | --- | | `USE_SSH` | Set to `true` to use SSH instead of the default HTTPS for the connection to the GitHub repo. | +| `DEPLOYMENT_BRANCH` | The branch that the website will be deployed to, defaults to `gh-pages` for normal repos and `master` for repository names ending in `github.io`. | | `CURRENT_BRANCH` | The branch that contains the latest docs changes that will be deployed. Usually, the branch will be `master`, but it could be any branch (default or otherwise) except for `gh-pages`. If nothing is set for this variable, then the current branch will be used. | ### Deploy