Deploy Docusaurus Site
Deploy to GitHub Pages​
Configuration​
-
Update the docusaurus config file with required changes. For explanation, type script config is used which is used in this project. You can find the config file in the root directory of the project with the name
docusaurus.config.js
. -
Update
url
with the GitHub Pages URL. For example,https://username.github.io
. -
Update
baseUrl
with the repository name. For example,/repository-name/
.infoThe
baseUrl
should start with/
and end with/
. -
Update the
organizationName
andprojectName
with the GitHub username and repository name respectively.
Run Deployment​
Using bash and gh-pages​
-
Run the following command to build and deploy the site to GitHub Pages.
GIT_USER=<GITHUB_USERNAME> yarn deploy
The above command triggers docusaurus deploy
command internally.
This procedure requires setting up pages in the GitHub repository settings.
- Go to the repository settings -> Pages.
- Under
Build and deployment
section, select Source asDeploy from a branch
. - Select the branch as
gh-pages
and directory as/root
and click onSave
.
Setting up GitHub Actions​
- GitHub actions pipeline can be copied from docusaurus deployment site.
- Update required fields like root directory branch name etc., if required.
This procedure requires setting up pages in the GitHub repository settings.
- Go to the repository setting -> Pages.
- Under
Build and deployment
section, select Source asGitHub Actions
.