mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 14:06:59 +02:00
Support publishing to Github Enterprise hosting (#689)
* Added support for Github Enterprise GH Pages * Fixed with prettier output * Tweak * Tweak * Tweak
This commit is contained in:
parent
93b2ebb53b
commit
2bd9a148c1
3 changed files with 24 additions and 6 deletions
|
@ -35,6 +35,10 @@ const USE_SSH = process.env.USE_SSH;
|
|||
// github.io indicates organization repos that deploy via master. All others use gh-pages.
|
||||
const DEPLOYMENT_BRANCH =
|
||||
PROJECT_NAME.indexOf('.github.io') !== -1 ? 'master' : 'gh-pages';
|
||||
const GITHUB_DOMAIN = 'github.com';
|
||||
// For GitHub enterprise, allow specifying a different host.
|
||||
const GITHUB_HOST =
|
||||
process.env.GITHUB_HOST || siteConfig.githubHost || GITHUB_DOMAIN;
|
||||
|
||||
if (!ORGANIZATION_NAME) {
|
||||
shell.echo(
|
||||
|
@ -52,9 +56,9 @@ if (!PROJECT_NAME) {
|
|||
|
||||
let remoteBranch;
|
||||
if (USE_SSH === 'true') {
|
||||
remoteBranch = `git@github.com:${ORGANIZATION_NAME}/${PROJECT_NAME}.git`;
|
||||
remoteBranch = `git@${GITHUB_HOST}:${ORGANIZATION_NAME}/${PROJECT_NAME}.git`;
|
||||
} else {
|
||||
remoteBranch = `https://${GIT_USER}@github.com/${ORGANIZATION_NAME}/${PROJECT_NAME}.git`;
|
||||
remoteBranch = `https://${GIT_USER}@${GITHUB_HOST}/${ORGANIZATION_NAME}/${PROJECT_NAME}.git`;
|
||||
}
|
||||
|
||||
if (IS_PULL_REQUEST) {
|
||||
|
@ -150,9 +154,11 @@ fs.copy(
|
|||
shell.exit(1);
|
||||
} else if (commitResults.code === 0) {
|
||||
// The commit might return a non-zero value when site is up to date.
|
||||
shell.echo(
|
||||
`Website is live at: https://${ORGANIZATION_NAME}.github.io/${PROJECT_NAME}`
|
||||
);
|
||||
const websiteURL =
|
||||
GITHUB_HOST === GITHUB_DOMAIN
|
||||
? `https://${ORGANIZATION_NAME}.github.io/${PROJECT_NAME}` // gh-pages hosted repo
|
||||
: `https://${GITHUB_HOST}/pages/${ORGANIZATION_NAME}/${PROJECT_NAME}`; // GitHub enterprise hosting.
|
||||
shell.echo(`Website is live at: ${websiteURL}`);
|
||||
shell.exit(0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue