primer-spec icon indicating copy to clipboard operation
primer-spec copied to clipboard

Primer Spec v2: Require deploy via GitHub Actions?

Open seshrs opened this issue 2 years ago • 1 comments

Context

I just learned that GitHub is making it easier to deploy to GitHub Pages via GitHub Actions, to the point where they're making it the default behavior for new repos.

This could have exciting consequences for Primer Spec!

Pros:

  • Allows previously impossible optimizations. We would be able to use arbitrary Jekyll plugins (to optimize images for example). We can also move most of the Primer Spec logic to a build-time plugin (to reduce how much JS executes in students' browsers, improving page load times)
  • Unlocks new features. We could modify the Deploy action to also produce a PDF version of each page (Option 3 of #136), and produce manifest files with information to power #92!
  • It's a really easy* change (I can provide a ~40 line file that can be used by any course)

Cons:

  • Deploying to GitHub Pages will use GitHub Actions minutes. I have no idea how precious of a commodity that is, but I've also heard that GitHub is pretty generous with the amount of time they provide... (maybe @awdeorio can provide context here?)
  • Course instructors need to opt-in and make the change to use the repo. (We'll need to make sure that courses that don't opt-in can continue using Primer Spec v1.)
  • It will be impossible to continue using Primer Spec v2 as standalone HTML. (Primer Spec v1 will remain as an option.)

Complete tangent:

Last weekend, I played around with two other static-site generators — Gatsby and Docusaurus — because I was curious about how they worked and what Primer Spec would look like on those frameworks. (Gatsby is incredibly complex, but also incredibly powerful! And "easy" to build insanely fast websites.)

I decided that while it's possible to build Primer Spec v2 as a Gatsby theme, it would take a lot of work for me (since I'd be rebuilding Primer Spec) and more importantly, it would probably involve significant effort from course instructors who opt-in since the Markdown API would change.

In the end, the only major upside to using Gatsby would be that Gatsby runs in a Node environment, which is much easier to set up than Ruby. Hence, we might as well stick with Jekyll. 🤷‍♂️

Gatsby also has a really nice hot-reload feature that allows you to preview changes to your Markdown files instantly without having to refresh the page. Apparently, Jekyll has that too (!) but I haven't tried it yet.

seshrs avatar Sep 07 '22 14:09 seshrs

Deploying to GitHub Pages will use GitHub Actions minutes. I have no idea how precious of a commodity that is, but I've also heard that GitHub is pretty generous with the amount of time they provide...

Not a big deal. I can't imagine this taking more than a ~1 minute. What really kills our Actions budget (which is currently 3,000 minutes on the Education Program) is long test suites which can take >10 minutes. Every. Damn. Time. Someone. Pushes (to an open PR).

If it's possible to detect-and-exit if there are no changes to the docs/ folder, that might be nice.

awdeorio avatar Sep 07 '22 20:09 awdeorio