Open tcatapano opened 3 years ago
DECISION: try doing this and see how it goes (along with other methods being tried)
Continuing to explore GitHub Pages and Netlify as deployment workflows.
GitHub Pages seems more simple but so far I cannot tell how to serve from a custom folder (e.g. _site/
). It is trivial to tell it to deploy from a particular branch, but then the only options for folders appears to be /root
and /docs
.
One option is to remove everything but the generated files and move them to the root, but this is a tedious task and should be automated.
But if we're going to automate, then it seems like it makes more sense to use some sort of GitHub Action or continuous integration to have the website redeploy every time we push to master, effectively separating the generation code from the resulting HTML so that the two shall never meet.
See this guide for easily creating a branch from a subfolder. This way, the chosen branch can be used as the source for GitHub pages. This is easily scriptable as it merely constitutes 3-4 git commands:
git add _site/ && git commit -m "Build site"
git push -d origin gh-pages # delete the existing branch
git subtree push --prefix _site/ origin -b gh-pages
In general, _site/
is the directory to be deployed as the root of the site and gh-pages
is the branch which GitHub pages uses as the source.
I've also been doing git reset HEAD~1
after these commands so that the commit with the _site/
folder doesn't stay in the main
branch. I made a deployment script to do all of this automatically and it seems to work well.
See:
https://docs.github.com/en/free-pro-team@latest/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site