Skip to content

feat: use docgen-action for documentation generation#128

Merged
fmontesi merged 14 commits into
leanprover:mainfrom
jessealama:use-docgen-action
Nov 19, 2025
Merged

feat: use docgen-action for documentation generation#128
fmontesi merged 14 commits into
leanprover:mainfrom
jessealama:use-docgen-action

Conversation

@jessealama

Copy link
Copy Markdown
Contributor

Uses leanprover-community/docgen-action to build & deploy docs.

Closes #121

Adds a GitHub Actions workflow that uses leanprover-community/docgen-action
to build and deploy documentation.

Closes leanprover#121
@jessealama jessealama requested a review from kim-em as a code owner October 26, 2025 10:45
@chenson2018 chenson2018 requested a review from fmontesi October 26, 2025 11:38
@chenson2018

Copy link
Copy Markdown
Collaborator

Adding @fmontesi as reviewer since he setup these docs.

Comment thread .github/workflows/docs.yml Outdated
Comment thread .github/workflows/docs.yml Outdated
Comment thread .github/workflows/docs.yml Outdated
@chenson2018

Copy link
Copy Markdown
Collaborator

I'm intentionally not approving the workflow to run yet so that this doesn't accidentally builds docs here, as this currently does so for PRs.

- Remove pull_request trigger to prevent running on PRs
- Remove cron schedule (superseded by push to main)
- Remove duplicate toolchain verification (handled by docgen-action)
@fmontesi

Copy link
Copy Markdown
Collaborator

Where does this publish the docs, exactly?

@chenson2018

Copy link
Copy Markdown
Collaborator

I think it targets the repo's GitHub pages by default, so something like leanprover.github.io/cslib

@fmontesi

Copy link
Copy Markdown
Collaborator

@leodemoura @kim-em (CC @swaratchaudhuri @barrettcw): Could we somehow set this up to write to https://lean-lang.org/cslib/doc/api (in the spirit of https://lean-lang.org/doc/api)?

@jessealama

Copy link
Copy Markdown
Contributor Author

I think it targets the repo's GitHub pages by default, so something like leanprover.github.io/cslib

Right, the idea was to take inspiration from Mathlib and publish the documentation to https://leanprover.github.io/cslib/docs using GitHub Pages, so we'd need to set that up. A somewhat more complex alternative would be to set up a separate docs repo like mathlib4_docs.

@fmontesi

Copy link
Copy Markdown
Collaborator

We do have that for now, that's where the doc is currently produced. Check out the code at https://github.com/cs-lean/cs-lean.github.io. It outputs to https://cs-lean.github.io/

@jessealama

Copy link
Copy Markdown
Contributor Author

@leodemoura @kim-em (CC @swaratchaudhuri @barrettcw): Could we somehow set this up to write to lean-lang.org/cslib/doc/api (in the spirit of lean-lang.org/doc/api)?

Shall we make a separate issue for this?

@arademaker

Copy link
Copy Markdown
Collaborator

Let me work on that with @kim-em since it would be nice to have the website and the API working in sync.

@chenson2018

Copy link
Copy Markdown
Collaborator

@arademaker Just making sure you have seen this Zulip thread: https://leanprover.zulipchat.com/#narrow/channel/513188-CSLib/topic/documentation.20best.20practices/with/553824087

As @fmontesi and I agree there, it is desirable for all building of docs to happen in this repo. What I suggest is, exactly as is already done for Mathlib on the website, that we host the docs in this repo's GitHub pages and simply link to them.

We merge this PR, check that it is building the docs, and update the website to link here. No extra coordination is needed and we can do this now. (Which would be nice, because I believe that currently the docs appear nowhere..)

@arademaker

Copy link
Copy Markdown
Collaborator

To make clear, as I wrote here, I agree to accept this PR. But first, we need to ask Lean Fro to add an exception to the rule that redirects all addresses under leanprover.github.io to lean-lang.org. Otherwise, the documentation will not be accessible.

@chenson2018

Copy link
Copy Markdown
Collaborator

To make clear, as I wrote here, I agree to accept this PR. But first, we need to ask Lean Fro to add an exception to the rule that redirects all addresses under leanprover.github.io to lean-lang.org. Otherwise, the documentation will not be accessible.

Thanks for the detailed reply! I didn't realize about the redirect rule, but it seems otherwise we're on the same page.

@arademaker

Copy link
Copy Markdown
Collaborator

Hi @fmontesi, I am ok to merge this PR. I talked with @nomeata and he believes the directs from leanprover.github.io to lean-lang.org will not block the leanprover.github.io/cslib/docs, let us see. If that works, it would be the easier/safer solution for the docs/API.

Comment thread .github/workflows/docs.yml
Prevents the docgen-action from attempting to run Jekyll for homepage generation.
@chenson2018

Copy link
Copy Markdown
Collaborator

I noticed here that there is a check for if the docs directory already exists. Do we need to go ahead and remove it in this PR for it to run properly?

@arademaker

Copy link
Copy Markdown
Collaborator

I noticed that too, but this did not cause any trouble to the action, right? I am thinking if we would like to eventually have the folder in the repo to test/debug document generation locally. We can rename it to docbuild to avoid any confusion too.

@chenson2018

Copy link
Copy Markdown
Collaborator

I noticed that too, but this did not cause any trouble to the action, right? I am thinking if we would like to eventually have the folder in the repo to test/debug document generation locally. We can rename it to docbuild to avoid any confusion too.

I think it stops building when it sees the directory, because that step only ran for one second and there is none of the output I would expect from the docs building.

@arademaker

arademaker commented Nov 15, 2025

Copy link
Copy Markdown
Collaborator

Indeed, analysing it more carefully, I dont see the artifact here as I see here.

@chenson2018

Copy link
Copy Markdown
Collaborator

With that confirmed, my preference is to remove the docs directory. My reasoning for this as opposed to renaming is that I don't think it is worth maintaining the separate manifest and toolchain for the relatively rare need to build docs locally. In the situations where that is required, it is simple enough to do so by adding the required docs lakefile yourself.

@arademaker

Copy link
Copy Markdown
Collaborator

There is a bib file in the docs that I can move to the website. I still don't have write permission in the repo, please go ahead and delete the folder.

@chenson2018

Copy link
Copy Markdown
Collaborator

Good catch on the references.bib file. This should stay in the repo as it is used when generating the docs. I couldn't find how to specify this to the action, so I asked on Zulip. If it's not supported currently I can make a (separate) PR for that.

For now I've removed the docs directory and moved references.bib to the root of the repo.

@arademaker

arademaker commented Nov 15, 2025

Copy link
Copy Markdown
Collaborator

This should stay in the repo as it is used when generating the docs.

I didn't know that. Maybe having it in "docbuild" is the solution? Let us see what people will say.

@chenson2018

Copy link
Copy Markdown
Collaborator

This should stay in the repo as it is used when generating the docs.

I didn't know that. Maybe having it in "docbuild" is the solution? Let us see what people will say.

Hmm, maybe. In the meantime I wouldn't consider this blocking, it just affects the rendering of a few links that we can follow up on. Is there anything else pending for this PR?

@chenson2018

Copy link
Copy Markdown
Collaborator

Placing it as docbuild/docs/references.bib is apparently what is needed for CI, I have gone ahead and done this.

@chenson2018 chenson2018 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am marking as approved on my end, but will leave it to @fmontesi for his approval and merging. You will also need to

...ensure GitHub Pages is enabled for your project: go to Settings > Pages and under Build and deployment > Source select "GitHub Actions" from the dropdown menu.

according to the action docs.

@arademaker

Copy link
Copy Markdown
Collaborator

Is there anything else pending for this PR?

I don't think so.

@arademaker arademaker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is all fine for me now.

@chenson2018

Copy link
Copy Markdown
Collaborator

With leanprover-community/docgen-action#15 merged, placing the references file at the root should work now.

@fmontesi

Copy link
Copy Markdown
Collaborator

There are some conflicts that prevent me from merging, can you have a look?

@chenson2018

Copy link
Copy Markdown
Collaborator

(I whiffed the merge conflict, give me a second to fix)

@chenson2018

Copy link
Copy Markdown
Collaborator

Okay @fmontesi, should be good now. If you are going to merge, please remember to enable the GitHub pages setting first as I describe above.

@fmontesi

Copy link
Copy Markdown
Collaborator

Mmmh I still see conflicts under docs/. :-\

@chenson2018

Copy link
Copy Markdown
Collaborator

Mmmh I still see conflicts under docs/. :-\

Yes, because there was another release since my comment. I have resolved again.

@fmontesi fmontesi merged commit f5d03ed into leanprover:main Nov 19, 2025
3 checks passed
@jessealama jessealama deleted the use-docgen-action branch December 1, 2025 15:15
thomaskwaring pushed a commit to thomaskwaring/cslib_SKI that referenced this pull request Apr 6, 2026
Uses leanprover-community/docgen-action to build & deploy docs.

Closes leanprover#121

---------

Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
benbrastmckie pushed a commit to benbrastmckie/cslib that referenced this pull request Jun 14, 2026
Uses leanprover-community/docgen-action to build & deploy docs.

Closes leanprover#121

---------

Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
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.

Use docgen-action

4 participants