Skip to content

feat: add multi-version documentation support#117

Merged
emjay0921 merged 5 commits intostablefrom
feat/multiversion-docs
Feb 4, 2026
Merged

feat: add multi-version documentation support#117
emjay0921 merged 5 commits intostablefrom
feat/multiversion-docs

Conversation

@emjay0921
Copy link
Contributor

Summary

  • Add new CI workflow (build_deploy_multiversion.yml) for building and deploying multi-version documentation
  • Fix version_switcher.js regex to properly handle version paths
  • Update switcher.json with correct version URLs for production
  • Modify old workflow to handle previews only (stable handled by new workflow)

How it works

The new workflow builds two versions:

  • v1.3 (stable) from stable branch -> deployed to root /
  • v2.0 (preview) from v2-odoo19-doc-refresh branch -> deployed to /v2.0/

Changes

File Change
.github/workflows/build_deploy_multiversion.yml New workflow for multi-version builds
.github/workflows/build_deploy.yml Now handles previews only (skips stable)
docs/_static/version_switcher.js Fixed regex /^\/v?[0-9.]+\// to handle version paths
docs/_static/switcher.json Updated URLs for v1.3 (root) and v2.0 (/v2.0/)

GitHub Actions Compatibility

This workflow uses only GitHub-owned actions and native commands:

  • actions/checkout@v3 - GitHub-owned
  • actions/setup-python@v4 - GitHub-owned
  • graphviz installed via apt-get (replaces ts-graphviz/setup-graphviz@v1)
  • Deployment via git commands (replaces peaceiris/actions-gh-pages@v3)

This approach avoids the organization's policy that blocks third-party actions.

Test plan

  • Tested locally using manual build approach
  • Updated workflow to use GitHub-owned actions only
  • Fixed git checkout issue (reset conf.py before branch switch)
  • Verify workflow runs successfully after merge to stable

- 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
- v1.3 (stable) now deployed to root /
- v2.0 (preview) now deployed to /v2.0/
- Updated switcher.json with correct URLs
Git checkout was failing because conf.py was modified (csvlexer disabled).
Now explicitly restores conf.py before branch switch.
@emjay0921 emjay0921 merged commit 092d937 into stable Feb 4, 2026
1 check was pending
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 significantly enhances the documentation system by implementing robust multi-version support. It introduces a new CI workflow to build and deploy distinct documentation versions (stable and preview) to different URL paths, alongside critical updates to the version switching logic and configuration. This change streamlines the management of documentation for various product versions and ensures compliance with GitHub Actions policies.

Highlights

  • Multi-version Documentation Support: A new CI workflow (build_deploy_multiversion.yml) has been introduced to build and deploy multiple versions of the documentation, specifically for '1.3 (stable)' and '2.0 (preview)'.
  • Version Switcher Logic Enhancement: The version_switcher.js script's regular expression was updated to correctly handle version paths, allowing for an optional 'v' prefix (e.g., /v1.3/ or /1.3/).
  • Documentation Version Configuration Update: The switcher.json file was modified to reflect the new documentation structure, mapping '1.3 (stable)' to the root URL and '2.0 (preview)' to the /v2.0/ path.
  • CI Workflow Refinement: The existing build_deploy.yml workflow was adjusted to focus solely on handling preview deployments, with stable deployments now managed by the new multi-version workflow.
  • GitHub Actions Compatibility: The new workflow exclusively utilizes GitHub-owned actions and native commands, ensuring compliance with organizational policies by avoiding third-party actions.
Changelog
  • docs/_static/switcher.json
    • Updated the 'stable (latest)' entry to '1.3 (stable)' and its version to '1.3', maintaining its deployment to the root URL.
    • Changed the '1.3' entry to '2.0 (preview)' with version '2.0', directing it to the /v2.0/ path.
  • docs/_static/version_switcher.js
    • Modified the regular expression ^/[0-9.]+/ to ^/v?[0-9.]+/ to correctly identify and remove version prefixes that may or may not include a 'v' (e.g., /v1.3/ or /1.3/).
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/build_deploy.yml
    • .github/workflows/build_deploy_multiversion.yml
Activity
  • The author performed local testing using a manual build approach.
  • The workflow was updated to exclusively utilize GitHub-owned actions.
  • A git checkout issue, specifically resetting conf.py before a branch switch, was addressed and fixed.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2026

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 configure the new stable (1.3) and preview (2.0) versions. The update to version_switcher.js fixes the regex to handle versioned paths like /v2.0/. I've suggested a small improvement to the JavaScript to make the code more concise. Overall, the changes look good and align with the goal of supporting multiple documentation versions.

Comment on lines 32 to +35
// 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.]+\//, '/');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For improved readability and slightly better performance, you can combine the two consecutive replace() calls into a single call. Using the | (OR) operator in the regular expression allows you to match either the preview path pattern or the version number pattern in one pass.

Suggested change
// 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.]+)\//, '/');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant