Write a post-merge job that generates documentation.
Depending on whether it makes sense to fragment by version inside or outside the generated documentation we can either publish the html artefact in a versioned directory, or let the documentation tool handle it.
E.g. for OOjs, we publish to doc.wikimedia.org/oojs/{version} where version is the git branch or release tag (master, v1.x, v.1.0.7). RESTBase could follow this, or (if meant to be reliable), let the versioning schema handle it and only publish the current version.