Skip to content

feat: add multi-version documentation support#115

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

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

Conversation

@emjay0921
Copy link
Contributor

@emjay0921 emjay0921 commented Feb 4, 2026

Summary

  • Add new CI workflow (build_deploy_multiversion.yml) for building and deploying multi-version documentation
  • Fix version_switcher.js regex to properly handle /v1.3/ paths (with 'v' prefix)
  • 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:

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

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 /v1.3/
docs/_static/switcher.json Updated URLs for v2.0 (root) and v1.3 (/v1.3/)

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
  • 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)
@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 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

  • Multi-version Documentation CI: A new GitHub Actions workflow (build_deploy_multiversion.yml) has been introduced to support building and deploying documentation for multiple versions (v2.0 and v1.3).
  • Version Switcher Logic Update: The version_switcher.js script has been updated with a more robust regular expression to correctly identify and handle version paths that include an optional 'v' prefix (e.g., /v1.3/). This ensures proper navigation between different documentation versions.
  • Documentation Version Configuration: The switcher.json file has been updated to reflect the new versioning scheme, mapping "2.0 (latest)" to the root URL and "1.3" to the /v1.3/ path, aligning with the multi-version deployment strategy.
  • CI Workflow Refinement: The existing build_deploy.yml workflow has been modified to focus solely on building and deploying preview documentation, with stable version deployments now handled by the new multi-version workflow.
  • Pending Action for CI: The new CI workflow requires approval for specific third-party GitHub Actions (ts-graphviz/setup-graphviz@v1, peaceiris/actions-gh-pages@v3) from an organization administrator before it can function correctly.
Changelog
  • .github/workflows/build_deploy.yml
    • The existing GitHub Actions workflow was updated to handle only preview deployments, delegating stable version deployments to the new multi-version workflow.
  • .github/workflows/build_deploy_multiversion.yml
    • A new GitHub Actions workflow was added to build and deploy multi-version documentation.
  • docs/_static/switcher.json
    • Updated the "stable (latest)" entry to "2.0 (latest)" and its corresponding version identifier to "2.0".
    • Modified the URL for version "1.3" to include a 'v' prefix, changing it from https://docs.openspp.org/1.3/ to https://docs.openspp.org/v1.3/.
  • docs/_static/version_switcher.js
    • Modified the regular expression used to remove version prefixes from currentPath. The new regex /^\/v?[0-9.]+\// now correctly handles paths like /v1.3/ by optionally matching a 'v' prefix.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/build_deploy.yml
    • .github/workflows/build_deploy_multiversion.yml
Activity
  • The author has tested the multi-version documentation build process locally using a manual approach.
  • A known issue has been identified where the new CI workflow requires an organization administrator to allow specific third-party GitHub Actions.
  • Verification of the workflow's successful execution after merging is pending, contingent on the resolution of the third-party action blocking issue.
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.

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 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.

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 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.

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

- 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
@emjay0921 emjay0921 merged commit 56bce55 into stable Feb 4, 2026
1 check passed
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2026

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