Home
Muller's Memoranda

How to Publish GitHub Pages Using Actions

There are lots of articles on this topic, but here are important things that tend to be omitted from other articles.

If you're using the peaceiris/actions-gh-pages package to deploy the built site from a GitHub Action, note that it "deploys" the build results by checking the site into the gh-pages branch (by default). This is fine for a site associated with a project, but can be surprising for a user or organization GitHub pages project, which by default publishes the main branch. You can change the branch that is published in the repository's settings. Change it to gh-pages.

Since you're not using Jekyll (the static site generator directly supported by GitHub), it may be a good idea to add a .nojekyll flag file to your project. This prevents some behavior/activity that you don't need.

References