-
Notifications
You must be signed in to change notification settings - Fork 173
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
Build docs to gh-pages with github actions #353
Conversation
Related lunarmodules#332. Add doc-site target to make file and yml file to build the docs. Following domenic's guide [1] but using leafo's gh actions like luacheck.yml. Builds the documentation for ldoc using the checked out version of ldoc and uses peaceiris/actions-gh-pages to publish. Once merged, docs will be available on https://lunarmodules.github.io/LDoc [1]: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
* Change stevedonovan.github.io -> lunarmodules.github.io for LDoc. * Change stevedonovan.github.com -> stevedonovan.github.io (.com is obsolete) * Fix link format for examples. Files are (now?) posted as colon.lua.html so we need to .lua extension in the url. * Fix release link for ldoc to a valid one.
Help people run the same process themselves.
@idbrii Thanks for this. I have started using it for my own projects. |
Thanks for this contribution. I'll look it over, but it might be WE before I am able to properly evaluate. |
This needs a rebase I believe. |
not sure about this, typically the gh-pages branch contains the published docs, and should have the docs for the latest released version. Not master imo. Typically I keep the generated docs in a I've been bitten by this several times, and must say I haven't made up my mind entirely yet... my 2cts |
Workflows can be configured to only deploy with new tags: on:
push:
tags:
- '*' |
As @Tieske comments, this actually opens up a whole can of worms. The current documentation site makes no note about what version it documents, only what version of ldoc it was generated with. Presumable those are the same but it shouldn't be assumed. Really we should find a way to have versioned documentation (see e.g. how Rust crates document by version, mdbook for example). In the mean time:
More later (WE+) when I can review further. I'm sure there are things we can do to improve the current situation, but probably not in exactly this form. |
- master | ||
push: | ||
branches: | ||
- master |
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.
Change this to:
on:
- pull_request:
- branches:
- - master
push:
- branches:
- - master
+ tags:
+ - 'doc-v*'
... (or something similar) and documentation can be versioned by creating tags prefixed with doc-v
:
$ git tag doc-v1.4.6
This way, docs will only be rebuilt on gh-pages
branch when one of these tags is pushed.
@alerque I'd love to see multiple versions of the docs generated 👍 |
This could be accomplished by adding a command or shell script like the following to the workflow: Old:mkdir doc_builds
for tag in $(git tag | grep "^doc-v"); do
git checkout ${tag}
make doc-site
mv out doc_builds/${tag}
done Edit: build_versioned_docs.sh |
Here is a live example I threw together from my build_docs branch (which is this PR rebased on master with some changes to the workflow). Note: "latest" is most recent doc tag (e.g. Not sure why |
@AntumDeluge Nice work on the multiple versions! The mdbook example includes a version selector inside the doc page, so I guess ldoc would need to be updated to support built-in version selection. Maybe the spartan index page is sufficient for now because mostly you'd link directly to a specific version? You might want to make the index link directly to manual/doc.md.html since that's where the primary content lives.
I believe the usage shows up strangely because ldoc doesn't use a comment for usage.
@alerque I don't understand what you mean by namespaces (https://github.com/lunarmodules/LDoc-docs ?) but maybe the structure of AntumDeluge's gh-pages solves that problem. The main thing that's missing now after AntumDeluge's work is showing the current project version on the generated doc page. I think we'd want that to be an argument to ldoc (instead of in config.ld) to make life easier for automation: |
I would be happy to see another PR that gets multiple-version output going for this repo and/or any LDoc project, but in the interest of getting URLs updated and a release out we'll go with just this building the current version for now. |
Related #332.
Builds docs to the gh-pages branch on every push to master. Also updates all dead links to point to live ones (or ones that will be live after this is merged).
Builds the documentation for ldoc using the checked out version of ldoc
and uses peaceiris/actions-gh-pages to publish.
Once merged, docs will be available on https://lunarmodules.github.io/LDoc
Currently, you can see the built docs on https://idbrii.github.io/lua-ldoc/manual/doc.md.html
After merging and the build cycles once, an owner needs to enable gh-pages on github: Settings > Pages and set "Source" to gh-pages and root.
Then all the dead links should be fixed. I'd recommend changing the project url in github to https://lunarmodules.github.io/LDoc/manual/doc.md.html which is the first useful page of the docs.
!! I didn't change the rockspec links because that change was already started in #332.
I think it's useful to have a guide for auto running ldoc, but maybe penlight would be a better example since it would have to install ldoc but it's publishing the docs to the repo itself instead of to a separate branch.