(A fairly small example of a static site generation, ugh, ""pipeline."" Half "this is, in general, my overall approach." And hopefully half "if you wanna run your own code for this kind of thing, it doesn't have to be an entire and massive thing.")
My static site generator is likely to be a few Lua files that I tinker with. I have them committed in whichever repo I want to be a website. (I like having them there instead of somewhere else. Like they're part of the site, and nearby if I want to change something, not off in some "library" or something.)
Will use the markdowny language from the previous post as an example, along with a build.lua
file. build.lua
asks the OS if there any .txt
files lying around and makes an HTML file for each:
So, I have that, smolmark.lua (mostly the code from that previous post, with some adjustments), and some text files in my repo, in a folder called "site." I run lua5.4 build.lua
there and it builds the site.
I've used GitHub Pages before. Previously I've mostly just clicked some buttons on the website to activate it and then let it upload whichever files are in my repo/some folder. I think maybe that was the way it was done earlier? These days, when enabling Pages, I can choose between "Deploy from a branch" and "GitHub Actions." "Deploy from a branch" is the "Classic Pages Experience," so maybe I used to do things like that because that was the way things were done. Not sure.
So not sure about olden days, but these days there are various GitHub Actions stuff you can use for different static site generators. GitHub Actions and its YAML are not the kind of things I really want to learn a lot about, but blep. It doesn't take that much figuring stuff out to run my Lua code and GitHub Pages the results.
Anyway so this workflow for deploying static content to GitHub Pages does most of the stuff I need. I suspect you can "instantiate" a workflow using a template like that or something, but I've just copied it to .github/workflows/main.yml in my repo. And:
main
for $default-branch
.Checkout
and Setup Pages
../site/
folder instead of the entire repo.My build step installs Lua and runs build.lua
:
So now it runs the code and uploads the Pages whenever I push something. Also I don't need to commit the generated HTML files. And all the code is there: The only thing I need for building it locally is a Lua. Seems okay or nice or something.