Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Update documentation to use dynamic versioning - #593

Merged
mewim merged 11 commits into
mainfrom
version-number
Jul 14, 2025
Merged

Update documentation to use dynamic versioning#593
mewim merged 11 commits into
mainfrom
version-number

Conversation

@mewim

@mewim mewim commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@mewim
mewim requested review from Copilot and sdht0 July 14, 2025 18:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces dynamic versioning in the documentation by centralizing the version value in a JSON file and automating its updates.

  • Added src/version.json to store the current version.
  • Updated MDX docs (installation.mdx, get-started/index.mdx, client-apis/c.mdx) to import version and replace static snippets with <Code> components driven by dynamic code blocks.
  • Added scripts/update-version.cjs and an NPM script to fetch the latest GitHub release and update version.json; removed the old GitHub Actions workflow.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/version.json Introduce a new JSON file to hold the version value.
src/content/docs/installation.mdx Import version.json, define DOWNLOAD_LINKS, and swap out hard-coded snippets for <Code> components.
src/content/docs/get-started/index.mdx Import version.json, define CODE_BLOCKS, and replace static Java/Swift snippets with <Code>.
src/content/docs/client-apis/c.mdx Import version.json, define CMAKE_CONTENT, and use <Code> in place of static CMake example.
scripts/update-version.cjs New script to fetch latest GitHub release and write version.json.
package.json Add update-version to the scripts section.
.github/workflows/update-kuzu-version.yml Removed obsolete workflow in favor of the update script.
Comments suppressed due to low confidence (4)

scripts/update-version.cjs:13

  • The log message refers to LatestVersion.json but the file being written is version.json. Update the message to Updating version.json... for clarity and consistency.
    console.log("Updating LatestVersion.json...");

scripts/update-version.cjs:1

  • There are no tests for the version update script. Consider adding unit or integration tests (e.g., mocking the GitHub API response and verifying version.json is updated correctly) to catch regressions.
const GITHUB_API_URL = "https://api.github.com/repos/kuzudb/kuzu/releases/latest";

scripts/update-version.cjs:7

  • Ensure fetch is available in the target Node environment (Node v18+ or via a polyfill like node-fetch); otherwise import or require it explicitly to avoid runtime errors.
    const response = await fetch(GITHUB_API_URL);

src/content/docs/client-apis/c.mdx:9

  • The CMake snippet no longer includes a URL_HASH for the download. Re-adding a SHA256 hash in ExternalProject_Add helps verify the integrity of the archive and prevents tampering.
export const CMAKE_CONTENT =`cmake_minimum_required(VERSION 3.11)

Comment thread src/content/docs/installation.mdx Outdated
mewim and others added 2 commits July 14, 2025 14:09
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mewim
mewim requested a review from prrao87 July 14, 2025 18:13

@sdht0 sdht0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work. I like it, except for the bad indentation in the code blocks.


(async () => {
console.log("Fetching latest version from GitHub...");
const response = await fetch(GITHUB_API_URL);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should have a way to manually specify the version, as this script should be run as part of the dev to main release merge, which could be before the actual version has been released.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have changed the behavior:

  • For the deployment pipeline, there is a way to skip version updating, so that the build process uses the version specified in JSON directly.
  • For dev docker deployment, always use the manually specified version (not doing auto version update).

Since now it is just a JSON file that can easily be edited directly. Using the script or workflow to do version update is mainly for automatically version maintaining but not necessary.

Comment thread src/version.json Outdated
@sdht0 sdht0 mentioned this pull request Jul 14, 2025
@mewim
mewim merged commit 02a6bbf into main Jul 14, 2025
1 of 3 checks passed
@mewim
mewim deleted the version-number branch July 14, 2025 18:42
run: npm i
- name: Update version
if: ${{ inputs.skipVersionUpdate != true }}
run: npm run update-version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thinking some more, instead of auto updating on deploy, how about we just check for changes and fail the build. This way, there won't ever me a mismatch between what we see locally on npm run dev vs what is actually deployed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I personally do not mind too much about the mismatching. I would prefer to just keep the JSON as a placeholder and allow the script to automatically do it. For https://github.com/kuzudb/kuzudb.github.io I do not update LatestVersion.json at all and solely rely on the script to maintain it during the deployment.

@sdht0 sdht0 Jul 14, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Although auto check won't really work for a new release.

I don't really like the magical version rewrite during deploy. I think the better way is to add a commit with the new version, like the auto format CI job.

@mewim mewim Jul 14, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it will work for new release though. We usually build the binaries first and then push the docs. Anyway, feel free to change the behavior to allow manual triggering or committing to the branch. I just personally do not care about it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants