Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I really enjoyed Jonty Wareing's hack recently where he built a static site generator inside a GitHub Action that works by doing the following:

1. Spin up a Python Flask web server on localhost

2. Run "wget --mirror" against it to crawl the site and save it as static files

3. Publish the resulting static files to GitHub Pages

The workflow is here. It's genius: https://github.com/pubstandards/pubstandards-london/blob/899...



Love it!

I have seen people doing fun things with GitHub Actions for the new GitHub profile readme feature as well.

This community chess game is one of my favorites https://github.com/timburgan/timburgan

It uses the creation GitHub issues on the repo as the input method/trgger which is a pretty clever hack.


Yeah I have an article about profile README hacks using Actions here: https://simonwillison.net/2020/Jul/10/self-updating-profile-...


Oh nice, I saw that one on the front page the other day.

Didn't realize it was you -- great post!


Instead of wget-ing localhost, maybe it's better to use Frozen-Flask[1] instead. I use it to implement my own static site generator for my personal website and it's working great.

[1] https://pythonhosted.org/Frozen-Flask/


That sounds too straightforward, therefore not worth as many internet points...

(Thanks that's a nice share!)


Heh, I worked on a site for a brand during the 2006 World Cup that did basically exactly this (although a PHP site, and a slightly rickety manual build process). They had bought pitchside advertising to be shown during the final, and anticipating enormous traffic which sadly never materialized. But we totally could have handled it!

Other over-optimisations on the same project included going all the way and including functionality to handle drawn lots as tie-breakers. This also never happened.


I was trying to look into GitHub actions but didn't really understand it. I just straight up called CLI commands eg. $git commit -m "..." and ran those after I put a key(in my case on a pi) and it does commits by CRON. I was just publishing sensor data to my GitHub readme. But it's cool that it works.


It's not often that I see things that are stupid but smart at the same time, so cool!


Genuine question: what is smart about this? What is the reasoning for not just writing the static assets by hand?


The site already existed, but they wanted to serve it statically to save on complexity and money.

If you dig into the repo you'll see that it's maintained using a YAML file, which is a smart way to deal with small sites that still contain structured content.

I do the same thing for my https://github.com/simonw/museums site.


Some possibilities come to mind:

1. because the people writing the content are not developers. 2. there’s dynamic content, but when you know you’re going to get a large influx of traffic from a single region/event, you can precompute it for a short period.


It's smart because it's a solution to a problem (freezing dynamic content) in one line of code, the wget command. It should work for most cases and it's easy to understand and deploy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: