Add ssh option to publish script

This commit is contained in:
Frank Li 2017-08-16 16:42:31 -07:00
parent 9d3afe2412
commit 37174fd305
2 changed files with 10 additions and 2 deletions

View file

@ -15,4 +15,4 @@ deployment:
- git config --global user.email "facebook-github-bot@users.noreply.github.com"
- git config --global user.name "Facebook GitHub Bot"
- echo "machine github.com login facebook-github-bot" > ~/.netrc
- npm install && cd website && GIT_USER=facebook-github-bot npm run publish-gh-pages
- npm install && cd website && GIT_USER=facebook-github-bot USE_SSH=true npm run publish-gh-pages

View file

@ -16,7 +16,15 @@ const CIRCLE_BRANCH = process.env.CIRCLE_BRANCH;
const CIRCLE_PROJECT_USERNAME = process.env.CIRCLE_PROJECT_USERNAME;
const CIRCLE_PROJECT_REPONAME = process.env.CIRCLE_PROJECT_REPONAME;
const CI_PULL_REQUEST = process.env.CI_PULL_REQUEST;
const remoteBranch = `https://${GIT_USER}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git`;
const USE_SSH = process.env.USE_SSH;
let remoteBranch;
if (USE_SSH === "true") {
remoteBranch = `git@github.com:${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git`;
} else {
remoteBranch = `https://${GIT_USER}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git`;
}
// build static html files, then push to gh-pages branch of specified repo