-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
De-couple build workflow from GitHub Pages publication #3404
De-couple build workflow from GitHub Pages publication #3404
Conversation
Combine `build.yml` and `github_pages.yml` into a single workflow file. Having `build.yml` be a separate workflow file that `github_pages.yml` calls has two problems: 1. All the inputs (and their types, descriptions, defaults) have to be duplicated in the two workflow files. 2. The reference to `@main` in `uses: "getpelican/pelican/.github/workflows/build.yml@main"` in the `github_pages.yml` workflow makes development and testing awkward. For example let's say you want to send a pull request that contains changes to `build.yml` and that also requires changes to `github_pages.yml` at the same time. The problem is that the `github_pages.yml` on your PR branch will still contain the reference to `build.yml` `@main` so if you try to test the branch's version of `github_pages.yml` it'll call the version of `build.yml` from `main` not from the PR branch and will fail. This commit move the build job from `build.yml` into `github_pages.yml` but makes the deploy job optional: it adds a `deploy` input and will only run the deploy job if `deploy = true` is passed. Previously a user could test their build without deploying it by calling the separate `build.yml` workflow. Now they can do it by calling the `github_pages.yml` workflow and passing `deploy=false`. This commit also moves the `concurrency` stuff from the workflow level to the deploy level: it's okay to have multiple build jobs running concurrently, just not multiple deploy jobs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @noelmiller,
I've given this a test and it works but I think there are two problems with my idea to split out a separate build.yml
file, so I'm very sorry to have wasted your time by getting you to do that:
- As you've pointed out you have to duplicate all of the inputs and their descriptions, types, etc in both files.
- The reference to
@main
inuses: "getpelican/pelican/.github/workflows/build.yml@main"
in thegithub_pages.yml
workflow makes development and testing awkward. For example let's say you want to send a pull request that contains changes tobuild.yml
and that also requires changes togithub_pages.yml
at the same time. The problem is that thegithub_pages.yml
on your PR branch will still contain the reference tobuild.yml
@main
so if you try to test the branch's version ofgithub_pages.yml
it'll call the version ofbuild.yml
frommain
not from the PR branch and will fail. This could be worked around but it's awkward.
So I think we should go back to having both jobs in the one github_pages.yml
file as you had it originally, sorry! I've sent you a PR to do this: noelmiller#1. Take a look at my PR and if you agree, please merge it into this PR and re-request a review from me.
Aside from that, the only other issue I see is adding docs explaining how to test your build without deploying it, but I think that can be done in a separate PR later.
Future thoughts
In the future if we ever want to add support for more deployment platforms (not just GitHub Pages) we can add those as additional optional jobs in the same workflow file.
The naming of the workflow as github_pages.yml
is a bit unfortunate now because the workflow doesn't always deploy to GitHub Pages, if you're only calling it to test the build or if (in future) you're calling it to deploy to a different platform then your workflow run doesn't actually have anything to do with GitHub Pages. A different name would probably be better but renaming the file would break any existing calling workflows that're using the current name. I think we'd have to put a github_pages.yml
workflow that just prints out an error message telling people to update their caller workflows (or perhaps it could delegate to the new workflow name, passing through all the arguments). I don't think we should rename the workflow now, let's just leave it as-is for now, just a thought for the future.
…le-file Combine `build.yml` and `github_pages.yml`
I like this approach a lot better. Where would the best place be to update the documentation regarding this? Or do you want to do that as a separate PR? Oh, I missed this part: "Aside from that, the only other issue I see is adding docs explaining how to test your build without deploying it, but I think that can be done in a separate PR later." I am still happy to update the docs to explain this, just having trouble tracking down where I can update that in your documentation. |
I'm actually a new contributor to Pelican myself, the GitHub Actions workflow is the only thing I've contributed. I think you could either add the documentation changes to this PR or do them as a separate PR, either way seems fine to me. The https://docs.getpelican.com/en/latest/tips.html page in the docs comes from the https://github.com/getpelican/pelican/blob/main/docs/tips.rst file in this repo, so that's the file you want to change. There's already docs in that file about how to use the workflow to deploy to GitHub Pages, so you just need to add a section explaining how to use the workflow to test the build only. Using the workflow just to test the build doesn't have anything in particular to do with GitHub Pages so I wouldn't put the new documentation in the GitHub Pages section. I'd maybe add a new top-level section to the file about using GitHub Actions to test site generation. |
Oh, I forgot to say if you would like to preview your changes to the docs locally you can run: tox -e docs ...to build the docs and then run: python3 -m http.server -d docs/_build/html/ ...to serve the docs, and open http://localhost:8000/ |
If you have
|
Added a new commit to update the docs. Any feedback?
Side Tangent:
This is what I ended up writing. Not sure how useful it would be? Works great for docs. To build: Equivalent docker commands would be: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the documentation enhancement. Seems good to me, aside from a few minor suggested changes 👍
@seanh: Any thoughts on the current state of this pull request? |
LGTM, I've tested this with my test site and it works 👍 I would like to rearrange the docs on the tips page but I can send a separate PR to do that later. I think @noelmiller has made a valuable contribution, so I'd say let's go ahead and merge this as soon as you're both happy with it. Might want to squash the commits |
I agree with squashing the commits. We went through 2 different refactors, so commit history is a bit messy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks to @noelmiller for the enhancement and to @seanh for reviewing 💫
Awesome! Thank you for the feedback and @seanh for pushing it over the finish line :) |
🥳 |
Pull Request Checklist
Resolves: #3403