feat: add multi-version documentation support#115
Conversation
- Add new workflow for building v2.0 (root) and v1.3 (/v1.3/) - Fix version_switcher.js regex to handle /v1.3/ paths - Update switcher.json with correct version URLs This enables deploying both documentation versions: - v2.0 (latest) from v2-odoo19-doc-refresh branch at / - v1.3 from stable branch at /v1.3/
- Disable csvlexer import in stable build (not in requirements) - Save version_switcher.js from stable before switching branches - Update old workflow to skip stable (now handled by multiversion) - Remove stable-specific code from old workflow (previews only)
Summary of ChangesHello @emjay0921, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive support for multi-version documentation, significantly enhancing the project's ability to maintain and present different versions of its documentation simultaneously. It achieves this by implementing a new CI/CD pipeline dedicated to multi-version builds, updating client-side JavaScript to correctly navigate these versions, and reconfiguring the version metadata. This change streamlines the documentation deployment process and improves user experience by ensuring accurate version switching between current and older documentation versions. Highlights
Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for multi-version documentation by adding a new CI workflow and updating the version switcher logic. The changes in switcher.json correctly update the version names and URLs to support the new versioning scheme. In version_switcher.js, the regex is correctly updated to handle version prefixes with 'v'. I've suggested a minor improvement to combine two regex replacements into one for better efficiency and readability.
| // This regex matches /previews/anything/ at the start | ||
| currentPath = currentPath.replace(/^\/previews\/[^\/]+\//, '/'); | ||
| // This regex matches /version-number/ patterns at the start | ||
| currentPath = currentPath.replace(/^\/[0-9.]+\//, '/'); | ||
| // This regex matches /v1.3/ or /1.3/ patterns at the start (with optional 'v' prefix) | ||
| currentPath = currentPath.replace(/^\/v?[0-9.]+\//, '/'); |
There was a problem hiding this comment.
For efficiency and conciseness, you can combine these two replace calls into a single one using the | (OR) operator in your regular expression. This avoids running a second replacement if the first one doesn't match and makes the code slightly cleaner.
| // This regex matches /previews/anything/ at the start | |
| currentPath = currentPath.replace(/^\/previews\/[^\/]+\//, '/'); | |
| // This regex matches /version-number/ patterns at the start | |
| currentPath = currentPath.replace(/^\/[0-9.]+\//, '/'); | |
| // This regex matches /v1.3/ or /1.3/ patterns at the start (with optional 'v' prefix) | |
| currentPath = currentPath.replace(/^\/v?[0-9.]+\//, '/'); | |
| // This regex matches /previews/..., /v1.3/ or /1.3/ patterns at the start | |
| currentPath = currentPath.replace(/^(\/previews\/[^\/]+|\/v?[0-9.]+)\//, '/'); |
- Remove ts-graphviz/setup-graphviz@v1, install graphviz via apt-get - Replace peaceiris/actions-gh-pages@v3 with git commands - Preserves preview deployments when deploying to cf-pages branch
|



Summary
build_deploy_multiversion.yml) for building and deploying multi-version documentationversion_switcher.jsregex to properly handle/v1.3/paths (with 'v' prefix)switcher.jsonwith correct version URLs for productionHow it works
The new workflow builds two versions:
v2-odoo19-doc-refreshbranch -> deployed to root/stablebranch -> deployed to/v1.3/Changes
.github/workflows/build_deploy_multiversion.yml.github/workflows/build_deploy.ymldocs/_static/version_switcher.js/^\/v?[0-9.]+\//to handle/v1.3/docs/_static/switcher.jsonGitHub Actions Compatibility
This workflow uses only GitHub-owned actions and native commands:
actions/checkout@v3- GitHub-ownedactions/setup-python@v4- GitHub-ownedgraphvizinstalled viaapt-get(replacests-graphviz/setup-graphviz@v1)peaceiris/actions-gh-pages@v3)This approach avoids the organization's policy that blocks third-party actions.
Test plan