I 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:
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:
cd <docu_site_root>, or delete the entire line if your Docusaurus website is at the root of your repo
build_dir's value from
buildif your Docusaurus website is at the root of your repo
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.