feat: add multi-version documentation support#116
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)
- 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 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, enhancing the project's ability to maintain and deploy different documentation versions simultaneously. It refines the documentation build and deployment process through a new, policy-compliant CI workflow, updates version configuration, and improves the client-side version switching logic. 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 adds support for multi-version documentation by introducing a new workflow and updating the version switcher logic. The changes to switcher.json correctly configure the new version names and URLs. The updated regular expression in version_switcher.js properly handles versioned paths. My review includes one suggestion to refactor the JavaScript code for better conciseness and efficiency. Overall, the changes are well-described and correctly implemented.
| // 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.
While these changes are correct, the two consecutive replace calls can be combined into a single, more efficient operation. This would make the code more concise by grouping the path-cleaning logic for both previews and versioned paths.
You could combine the logic into a single replace call using a regular expression like:
currentPath = currentPath.replace(/^\/(previews\/[^\/]+|v?[0-9.]+)\//, '/');- v1.3 (stable) now deployed to root / - v2.0 (preview) now deployed to /v2.0/ - Updated switcher.json with correct URLs
|



Summary
build_deploy_multiversion.yml) for building and deploying multi-version documentationversion_switcher.jsregex to properly handle version pathsswitcher.jsonwith correct version URLs for productionHow it works
The new workflow builds two versions:
stablebranch -> deployed to root/v2-odoo19-doc-refreshbranch -> deployed to/v2.0/Changes
.github/workflows/build_deploy_multiversion.yml.github/workflows/build_deploy.ymldocs/_static/version_switcher.js/^\/v?[0-9.]+\//to handle version pathsdocs/_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