Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to gh actions page build #446

Merged
merged 5 commits into from
Jul 23, 2024

Conversation

sneakers-the-rat
Copy link
Contributor

Currently the site is built with the old style github pages implicit jekyll build using the github-pages gem.

Github has been moving away from this mode of doing github pages, and i believe is encouraging people to use the github actions style build anyway. This gives us full control over the build process, where the github-pages gem style build restricts us to certain whitelisted packages.

In particular, we want to be able to write custom plugins for the build process that allow us to do stuff like generate badge images for every page depending on their review status as per this discussion: pyOpenSci/software-peer-review#293 (comment)

This should be a function-neutral PR, I just took the example workflow from here: https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml

and I set us up to use the most recent version of jekyll and ruby (i guess 3.3.4 got released a few days ago). It looks like we have vendored in all the minimal mistakes code and aren't even using that as a theme anymore, correct? so I didn't add it as a dependency.

Copy link
Member

@lwasser lwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneakers-the-rat this is a huge improvement in our build. ive been doing things the same way for a long time and it's really cool to see the "in place // quiet" improvements here.

thank you so so much. i'm merging now but i left a few questions (just so i fully understand!).

on:
# Runs on pushes targeting the default branch
push:
branches: [$default-branch]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneakers-the-rat i didn't know there was a $default-branch variable for actions. gosh that would have saved me a lot of time when we did the updates master --> main branch forever ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait actually idk if this works lmao I think that might need to be a literal, but the sample action had this in it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 so i'm not sure it does?? https://github.com/pyOpenSci/pyopensci.github.io/actions/workflows/gh-pages.yml

when i look at that this build after directly commiting a small change to main 🙈 it wasn't triggered
Screenshot 2024-07-23 at 4 49 21 PM

but what did get triggered is this action

could that be because i have github pages "turned on " in the repo settings somewhere? it's odd because the "pages" tab says this:
Screenshot 2024-07-23 at 4 50 45 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes - sorry, so yeah that should be replaced by main, and then you go to the pages setting and switch it from "deploy from branch" to "github action" . we just did this switch for our lab website and after that it worked without fuss

@@ -0,0 +1 @@
3.3.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also didn't know you could pin the ruby version. gosh learning so much.

gem "jekyll-include-cache"
gem "webrick"
gem "html-proofer"
gem "ffi", "= 1.16.3"

gem "jekyll", "~>4.3.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneakers-the-rat i am going to merge this but i have a question.

You may have said this in the pr header but i want to be clear about what this does!
Is going this route going to allow us to avoid that github pages restriction of using other jekyll plugins and gems if we can also write our own? I just know that for a while that has also been a constraint for the site.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! We can add whatever gems we want here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay!!

@@ -217,6 +217,7 @@ kramdown:
sass:
sass_dir: _sass
style: compressed # http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gosh does this automagically minify the css?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as much as css can be minified! (it doesn't eg. simplify rules afaik, and you can't do the javascript thing of replacing all names with single characters, yes it does remove as much as it can https://sass-lang.com/documentation/cli/dart-sass/#style )

@lwasser lwasser merged commit 0979c07 into pyOpenSci:main Jul 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants