diff --git a/README.md b/README.md index 3b2ed880..7ea5f5c9 100644 --- a/README.md +++ b/README.md @@ -111,3 +111,15 @@ When documentation changes, the repository version should be incremented. Becaus - PATCH version will be changed when the documentation is updated. It does not mean the code version is updated. - For example, when a typo is fixed in the documentation, the PATCH version is updated. + +To increment the MAJOR or MINOR version, update the `package.json` file in the root directory. Then run the following command to update the documentation version: + +```bash +yarn run version:doc +``` + +To increment the PATCH version, run the following command: + +```bash +yarn run version:doc:patch +``` diff --git a/package.json b/package.json index 5576e91d..decbb151 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "version": "lerna version", "prepare": "husky install", "lint": "cross-env NODE_OPTIONS=--max-old-space-size=8192 yarn eslint packages", - "version:minor:doc": "node ./scripts/versioning/sync-docs-version.js" + "version:doc": "node ./scripts/versioning/sync-docs-version.js", + "version:doc:patch": "node ./scripts/versioning/update-docs-patch-version.js" }, "devDependencies": { "@jest/globals": "^29.7.0", diff --git a/scripts/versioning/update-docs-patch-version.js b/scripts/versioning/update-docs-patch-version.js new file mode 100644 index 00000000..3b8c3155 --- /dev/null +++ b/scripts/versioning/update-docs-patch-version.js @@ -0,0 +1,40 @@ +const path = require('path'); +const { execSync } = require('child_process'); + +const versions = require(path.resolve(__dirname, '../..', 'documentation/versions.json')); + +const getLatestDocVersion = () => { + return versions[0] || '1.0.0'; +}; + +const updateDocVersion = async () => { + try { + const currentVersion = getLatestDocVersion(); + console.log('Current doc version:', currentVersion); + + // Parse version components + const [major, minor, patch] = currentVersion.split('.').map(Number); + + // Create new version with incremented patch + const newVersion = `${major}.${minor}.${patch + 1}`; + console.log(`Updating documentation to version ${newVersion}...`); + + try { + // Create new version using docusaurus command + execSync(`cd documentation && npm run docusaurus docs:version ${newVersion}`, { + stdio: 'inherit', + }); + + console.log('Documentation version updated successfully!'); + } catch (error) { + console.error('Error updating documentation version:', error); + process.exit(1); + } + } catch (error) { + console.error('Error in update process:', error); + process.exit(1); + } +}; + +// Execute the update +updateDocVersion();