feat: add custom commit message (#1136)

* feat: add custom commit message

Addresses: #1135

* Update publish-gh-pages.js

* add support to v2 as well

* docs: add them

* docs
This commit is contained in:
Jake Bolam 2018-12-03 23:26:21 -05:00 committed by Endilie Yacop Sucipto
parent cb1395ee29
commit c4a9b31984
3 changed files with 16 additions and 3 deletions

View file

@ -39,6 +39,7 @@ const GITHUB_DOMAIN = 'github.com';
// For GitHub enterprise, allow specifying a different host.
const GITHUB_HOST =
process.env.GITHUB_HOST || siteConfig.githubHost || GITHUB_DOMAIN;
const CUSTOM_COMMIT_MESSAGE = process.env.CUSTOM_COMMIT_MESSAGE;
if (!ORGANIZATION_NAME) {
shell.echo(
@ -166,8 +167,9 @@ fs.copy(
shell.cd(path.join('build', `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`));
shell.exec('git add --all');
const commitMessage = CUSTOM_COMMIT_MESSAGE || 'Deploy website';
const commitResults = shell.exec(
`git commit -m "Deploy website" -m "Deploy website version based on ${currentCommit}"`,
`git commit -m "${commitMessage}" -m "Deploy website version based on ${currentCommit}"`,
);
if (shell.exec(`git push origin ${DEPLOYMENT_BRANCH}`).code !== 0) {
shell.echo('Error: Git push failed');