diff --git a/docs/getting-started-publishing.md b/docs/getting-started-publishing.md index ee1a1e98c6..03e0879c5b 100644 --- a/docs/getting-started-publishing.md +++ b/docs/getting-started-publishing.md @@ -162,8 +162,17 @@ Now, whenever a new commit lands in `master`, CircleCI will run your suite of te ### Tips & Tricks -When initially deploying to a `gh-pages` branch using Circle CI, you may notice that some jobs triggered by commits to the `gh-pages` branch fail to run successfully due to a lack of tests. You can easily work around this by creating a basic Circle CI config with the following contents: +When initially deploying to a `gh-pages` branch using Circle CI, you may notice that some jobs triggered by commits to the `gh-pages` branch fail to run successfully due to a lack of tests (This can also result in chat/slack build failure notifications). +You can work around this easily by: +- Setting the environment variable `CUSTOM_COMMIT_MESSAGE` flag to the `publish-gh-pages` command with the contents of `[skip ci]`. +e.g. +```bash +CUSTOM_COMMIT_MESSAGE="[skip ci]" \ + yarn run publish-gh-pages # or `npm run publish-gh-pages` +``` + +- Alternatively you can work around this by creating a basic Circle CI config with the following contents: ```yaml # Circle CI 2.0 Config File # This config file will prevent tests from being run on the gh-pages branch. diff --git a/v1/lib/publish-gh-pages.js b/v1/lib/publish-gh-pages.js index 82b5e9d985..79d2494fe1 100755 --- a/v1/lib/publish-gh-pages.js +++ b/v1/lib/publish-gh-pages.js @@ -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'); diff --git a/v2/lib/commands/deploy.js b/v2/lib/commands/deploy.js index 384937cdba..1f32105b2a 100644 --- a/v2/lib/commands/deploy.js +++ b/v2/lib/commands/deploy.js @@ -158,8 +158,10 @@ module.exports = async function deploy(siteDir) { shell.cd(path.join('build', `${projectName}-${deploymentBranch}`)); shell.exec('git add --all'); + const commitMessage = + process.env.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 ${deploymentBranch}`).code !== 0) { throw new Error('Error: Git push failed');