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

Add GitHub Actions workflow for GitHub Pages #3189

Merged
merged 2 commits into from
Oct 29, 2023

Conversation

seanh
Copy link
Contributor

@seanh seanh commented Aug 28, 2023

Add a GitHub Actions workflow that users can use to publish their Pelican sites to GitHub Pages by running pelican on GitHub Actions, without having to run pelican locally or push the output directory to a branch. See: #3174 for some discussion.

@@ -0,0 +1,64 @@
name: Deploy to GitHub Pages
Copy link
Contributor Author

Choose a reason for hiding this comment

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

GitHub themselves provide starter workflows for publishing to GitHub Pages using various static site generators (unfortunately not including Pelican), the way I've designed this workflow is similar to these: https://github.com/actions/starter-workflows/tree/main/pages

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how I feel about hosting a workflow file under .github/workflows that is not used in this repository, just to make it reusable. I'm just saying this before I start reviewing, which will have to wait for some free time for me.

Copy link
Contributor Author

@seanh seanh Sep 3, 2023

Choose a reason for hiding this comment

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

Reusable workflows have to be under .github/workflows/ otherwise GitHub won't recognise them. Unfortunately they can't be in a subdirectory of .github/workflows/ either (docs).

It could be moved into a .github/workflows/ directory of a separate getpelican/workflows repo, but the nice thing about having the workflow be in the getpelican/pelican repo itself is that you can change the workflow and its associated documentation at the same time, in one PR. So we might want to move the workflow's documentation into the README.md of the new workflows repo as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how I feel about hosting a workflow file under .github/workflows that is not used in this repository, just to make it reusable. I'm just saying this before I start reviewing, which will have to wait for some free time for me.

That is a valid point. On the other side, I think it would be good to have (even if I don't use it). Many projects on GH just use a different approach: They create a dedicated repo for that action in same org.
One could do the same and have the minimal documentation as a pelican site deployed as github page from that said repo.
Benefits:

  • this repo is not cluttered with unused code
  • the action is tested and used with it's own documentation

Con:

  • another repo to maintain

docs/tips.rst Outdated Show resolved Hide resolved
docs/tips.rst Outdated Show resolved Hide resolved
@seanh
Copy link
Contributor Author

seanh commented Aug 28, 2023

When I have a bit more time I can update my demo site to use the github_pages.yml workflow from this branch, so that'll work as a test/demo of this PR (the demo site currently uses the one from my https://github.com/seanh/pelican-github-pages repo)

@seanh seanh marked this pull request as draft August 28, 2023 20:52
docs/tips.rst Outdated Show resolved Hide resolved
seanh added a commit to seanh/ghp-pelican-demo that referenced this pull request Sep 3, 2023
Change to using the GitHub Actions reusable workflow from
getpelican/pelican#3189
Add a GitHub Actions workflow that users can use to publish their
Pelican sites to GitHub Pages by running `pelican` on GitHub Actions,
without having to run `pelican` locally and push the output directory to
a branch.

See: getpelican#3174
@seanh seanh force-pushed the publish-to-ghp-using-gha branch from 1bd64fd to 29185e4 Compare September 3, 2023 14:15
@seanh seanh marked this pull request as ready for review September 3, 2023 14:25
@seanh
Copy link
Contributor Author

seanh commented Sep 3, 2023

@avaris I've done a bit more work on this and it's ready for review now:

  • Removed the caching stuff from this PR since it's a bit of a tricky problem in its own right. If desired I can send a follow-up PR to add caching so we can discuss and accept or reject it separately
  • Added a requirements input to the workflow to enable users to install things like markdown, typogrify and plugins
  • Added settings and output-path inputs to the workflow, corresponding to pelican's --settings and --output options
  • Tidied up the docs by using a table to document all the workflow inputs at once

I've also changed https://github.com/seanh/pelican-github-pages-demo/ to use the workflow from this PR, so see that repo for a working example

@seanh seanh requested a review from avaris September 3, 2023 14:49
@avaris
Copy link
Member

avaris commented Oct 5, 2023

Thanks @seanh, I will certainly take a look when my schedule permits, but it's very unlikely for the next couple weeks :(.

@seanh
Copy link
Contributor Author

seanh commented Oct 6, 2023

Hey, no worries 👍

@avaris avaris self-assigned this Oct 28, 2023
Copy link
Member

@avaris avaris left a comment

Choose a reason for hiding this comment

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

I added the additional documentation. Good to merge, thanks!

@justinmayer justinmayer added this to the Pelican 4.9 milestone Oct 29, 2023
Copy link
Member

@justinmayer justinmayer left a comment

Choose a reason for hiding this comment

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

Many thanks to @seanh for the contribution and to @avaris for reviewing and documenting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants