From bc94570fe0805c04bb20860c4e0d57a4c4d670bc Mon Sep 17 00:00:00 2001 From: ayan-b Date: Thu, 23 Jul 2020 14:36:18 +0530 Subject: [PATCH] docs: Add azure-pipelines CI guide Closes https://github.com/facebook/docusaurus/issues/1208 --- docs/getting-started-publishing.md | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/docs/getting-started-publishing.md b/docs/getting-started-publishing.md index 6595df14b27a..4b80ff113b82 100644 --- a/docs/getting-started-publishing.md +++ b/docs/getting-started-publishing.md @@ -250,6 +250,45 @@ script: Now, whenever a new commit lands in `master`, Travis CI will run your suite of tests and, if everything passes, your website will be deployed via the `publish-gh-pages` script. +### Using Azure Pipelines + +1. Sign Up at [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) if you haven't already. +1. Create an organization and within the organization create a project and connect your repository from GitHub. +1. Go to https://github.com/settings/tokens and generate a new [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) with repository scope. +1. In the project page (which looks like https://dev.azure.com/ORG_NAME/REPO_NAME/_build) create a new pipeline with the following text. Also, click on edit and add a new environment variable named `GH_TOKEN` with your newly generated token as its value, then `GH_EMAIL` (your email address) and `GH_NAME` (your GitHub username). Make sure to mark them as secret. Alternatively, you can also add a file named `azure-pipelines.yml` at yout repository root. + +```yaml +# azure-pipelines.yml +trigger: +- master + +pool: + vmImage: 'ubuntu-latest' + +steps: +- checkout: self + persistCredentials: true + +- task: NodeTool@0 + inputs: + versionSpec: '10.x' + displayName: 'Install Node.js' + +- script: | + git config --global user.name "${GH_NAME}" + git config --global user.email "${GH_EMAIL}" + git checkout -b master + echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc + cd website + yarn install + GIT_USER="${GH_NAME}" CURRENT_BRANCH=master yarn run publish-gh-pages + env: + GH_NAME: $(GH_NAME) + GH_EMAIL: $(GH_EMAIL) + GH_TOKEN: $(GH_TOKEN) + displayName: 'yarn install and build' +``` + ### Hosting on ZEIT Now With [ZEIT Now](#using-zeit-now), you can deploy your site and connect it to [GitHub](https://zeit.co/github) or [GitLab](https://zeit.co/gitlab) to automatically receive a new deployment every time you push a commit.