This is an automated email from the ASF dual-hosted git repository.

zihaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 6ce246a914 [Chore] Fix 3.3.0-alpha not showing (#973)
6ce246a914 is described below

commit 6ce246a914b35217e9513e4498fe9e8dd9ed8969
Author: xiangzihao <[email protected]>
AuthorDate: Tue Apr 8 11:06:49 2025 +0800

    [Chore] Fix 3.3.0-alpha not showing (#973)
---
 scripts/generate_docs.js | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/generate_docs.js b/scripts/generate_docs.js
index 5b438bdb31..821f1e6203 100644
--- a/scripts/generate_docs.js
+++ b/scripts/generate_docs.js
@@ -26,8 +26,21 @@ const getVersion = (name) => {
   if (name === "docsdev") {
     return "dev";
   }
-  const result = name.match(/(\d+)-(\d+)-(\d+)/);
-  return result[1] + "." + result[2] + "." + result[3];
+  // docs3-3-0
+  const regex1 = new RegExp(/(\d+)-(\d+)-(\d+)/);
+
+  // docs3-3-0-alpha
+  const regex2 = new RegExp(/(\d+)-(\d+)-(\d+)-(\w+)/);
+
+  const result = name.match(regex2) ? name.match(regex2) : name.match(regex1)
+
+  if (result.length === 4) {
+    return result[1] + "." + result[2] + "." + result[3];
+  } else if (result.length === 5) {
+    return result[1] + "." + result[2] + "." + result[3] + "-" + result[4];
+  } else {
+    throw new Error("Invalid version format");
+  }
 };
 
 const formatFile = (filePath) => {

Reply via email to