4 ms·
The simplicity of the example might give the wrong impression here. A Github action that produces some static HTML is of course without value, Github pages can
by onli 2y ago
The simplicity of the example might give the wrong impression here. A Github action that produces some static HTML is of course without value, Github pages can host HTML files without needing any workflow action. The idea of the article seems to be that the Github action file can do something interesting regularly, like downloading a json file from somewhere, then produce a page and publish it. That is kind of neat then, as you can have your static site generator offloaded to Github's architecture - instead of needing to run that somewhere else, like your own PC or a dedicated server.
- 0xbadcafebee 2y agoActually it does have value, since I literally do what you describe, I just haven't plumbed the GitHub Pages part yet. Here[1] I keep docs about the truck camper I'm building. I use one GHA[2] to generate the TOC, and another GHA[3] to run make in the root directory and then commit and push modified files (to a PR branch). The make process uses scripts to generate new Markdown pages based on a template, auto-generating Markdown tables from CSV files and inserting them into the final Markdown. By keeping this all as a GHA, I don't have to do anything manual to generate the new site. I just open a PR with my new content and the actions fix up everything. It's basically a janky static site editor but using simpler tools I'm familiar with and can customize easier. I've been wanting to host it as GH Pages but haven't gotten around to it. Partly I need to do this because my 3d models run into GitHub's LFS bandwidth limits and hopefully Pages won't (if I do run into Pages' bandwidth limit, I'll need to find some other cheap hosting, or not share my models anymore =/ ) [1] https://github.com/peterwwillis/truckcamper https://github.com/peterwwillis/truckcamper [2] https://github.com/peterwwillis/truckcamper/blob/main/.github/workflows/toc-generator.yml https://github.com/peterwwillis/truckcamper/blob/main/.githu... [3] https://github.com/peterwwillis/truckcamper/blob/main/.github/workflows/template-generator.yml https://github.com/peterwwillis/truckcamper/blob/main/.githu...
- onli 2y agoDo what works for you of course, but you could also just run your makefile on our PC and then push the generated HTML to the gh-pages branch/repo. I don't see (much? any?) value in running that on a server, if it's not triggered regularly for some external source. There are no simpler tools here, just the same with the gh layer on top.
- simonw 2y agoI make enough edits to my various projects from my phone these days that I avoid anything where I would need to run a script on my laptop.
- 0xbadcafebee 2y agoThe value is 1) I can edit the site from any device with a web browser, 2) I don't want to run a process manually, I want it to be automatic (I don't want extra work every time I change a line of text), 3) other people can contribute content through a PR and everything is fixed again with no need for me (or them) to run anything, 4) there are canned github actions to do things so I don't have to figure them out, 5) once I add the Pages plumbing it'll automatically publish a website for me
- onli 2y agoI don't get 4) and 5). Plumbing for what? This makes me think it is not understood that github pages will just host any html you put in its repo. There is no magic plumbing in play here, not on your side at least. 1) okay, I can see that (also @simonw, the other comment). 2) is a tradeoff, you have a lot more work with setting this all up. but okay. For 3), if building the site is easy enough and documented properly, having to run a build script once and having it as part of the PR is in my experience not a problem for contributors - and there is also a tradeoff here against them having to understand what hidden steps the Github action will do, when wanting to contribute.
- deleted 2y ago[deleted]
- simonw 2y agoThe other thing that is useful about this pattern it means you can deploy files to GitHub Pages that don't exist at all in your repository. I like that for frequently changing data where it would be wasteful to record all prior versions, or that duplicates data already in the repository. My https://tools.simonwillison.net/colophon https://tools.simonwillison.net/colophon page is a good example of that.
- onli 2y agoI can see how that aspect can be useful.