GitHub Action for Docusaurus
Evan Tay
Software Engineer at PadletI got tired of deploying my Docusaurus website to GitHub Pages manually, and decided to do something about it using GitHub Action.
Initially, I was planning to follow the official guide on doing so. However, it was actually much more complicated than I liked. I did not really want to generate and store a SSH key on GitHub. Too much effort man.
I decided it was better off for me to write my own script. Here it is:
#
deploy-docusaurus.ymlcaution
The script below assumes that your Docusaurus website resides at /website
of your repo. If that is not the case for you, you will need to:
- Change
cd website
tocd <docu_site_root>
, or delete the entire line if your Docusaurus website is at the root of your repo/
- Change
build_dir
's value fromwebsite/build
to<docu_site_root>/build
, orbuild
if your Docusaurus website is at the root of your repo/
note
GitHub will automatically add GITHUB_TOKEN
to Secrets. You need not do so. See this for more information.
To see this script in action, visit my personal website repo.