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
urlwith the GitHub Pages URL. For example,https://username.github.io. -
Update
baseUrlwith the repository name. For example,/repository-name/.infoThe
baseUrlshould start with/and end with/. -
Update the
organizationNameandprojectNamewith 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 deploymentsection, select Source asDeploy from a branch. - Select the branch as
gh-pagesand directory as/rootand 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 deploymentsection, select Source asGitHub Actions.