enthought / envisage

Envisage is a Python-based framework for building applications whose functionalities can be extended by adding "plug-ins".
http://docs.enthought.com/envisage/
Other
80 stars 26 forks source link

Automate documentation building #565

Closed mdickinson closed 1 year ago

mdickinson commented 1 year ago

This PR automates documentation building for the Envisage repository. It repurposes the current structure of the gh-pages branch, and adds workflows for updating documentation on every push to main and every release.

New gh-pages structure

The new gh-pages structure is as follows:

Note: as before, documentation for a bugfix release (e.g., Envisage 7.1.1) overwrites the documentation for the previous release (e.g., Envisage 7.1.0). This is deliberate - documentation bugs may be fixed in a bugfix release, but it should be rare for an API to change in a bugfix release, and for any given <major>.<minor> version number users should usually be seeing the latest documentation.

Workflows

This PR adds two workflows for updating the docs:

Both workflows use the new graft_docs.py script to do the work of copying the newly-built docs to the appropriate place in the gh-pages branch.

The workflows are very similar: the key differences between the two workflows are the triggers, and the passing of the --tag argument to graft_docs.py in the release case. Otherwise, the workflows are essentially identical.

Notes

I've created a branch gh-pages-staging for testing purposes; both workflows are currently pushing changes to that branch instead of gh-pages. When we're happy that this PR is working as intended, we should replace gh-pages-staging with gh-pages throughout. At the same time, we'll need to remove branch protections on the gh-pages branch.

To do after PR approval and prior to merge:

mdickinson commented 1 year ago

A couple of notes from an internal discussion:

mdickinson commented 1 year ago

And two more thoughts:

mdickinson commented 1 year ago

I've updated the branch protections for the gh-pages branch to something that'll allow the workflows to push commits, but that should still protect us from accidental changes.

mdickinson commented 1 year ago

@corranwebster Thanks for review!

[...] we probably need to start enforcing that the docs build cleanly in every PR [...]

Yep, the test-doc-build.yml workflow already does this for PR commits. The duplication between that and the two workflows in this PR is a little bit of a DRY violation, and could potentially be pulled out into a composite action.

[...] about the usefulness of having a "release"/"stable" or similar symlink [...]

I've updated this PR to add a "latest" symlink in 6677787f1c1cddda9c270a1e59c1a54fd0de63e0.

Do we want info@enthought.com here?

Sure, why not. Done in 2c7ab646a16795c3b464ae8ea0e53b91ae617f6b.

mdickinson commented 1 year ago

How about the docs/ directory as a home for graft_docs.py?

Done in fa666d083fadaed541a285f5d6be15c819e58d43

mdickinson commented 1 year ago

And apparently I managed to introduce a syntax error into the workflow the moment I stopped testing. Fixed in ebc60f9d6d0b3b628cbafeab7f925d92f62affc8.