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

tisonkun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new deb8285ad7 fix(website): link downloads to the latest source release 
(#9298)
deb8285ad7 is described below

commit deb8285ad772f3beecf4b55248a18a271cfe20ee
Author: tison <[email protected]>
AuthorDate: Sat Nov 28 01:40:03 2026 +0800

    fix(website): link downloads to the latest source release (#9298)
    
    Signed-off-by: tison <[email protected]>
---
 website/config/site-helpers.js               | 14 ++++++++
 website/docusaurus.config.js                 |  4 +--
 website/src/components/DownloadLink/index.js | 49 ++++++++++------------------
 3 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/website/config/site-helpers.js b/website/config/site-helpers.js
index a942030300..82242c2e1f 100644
--- a/website/config/site-helpers.js
+++ b/website/config/site-helpers.js
@@ -25,6 +25,19 @@ function envValue(name, fallback) {
   return process.env[name] ? process.env[name] : fallback;
 }
 
+function getLatestRelease() {
+  try {
+    // Weekly final tags live on release branches outside main's history.
+    const tags = exec("git tag --list 'v[0-9]*'", { encoding: "utf8" })
+      .trim()
+      .split("\n");
+    const latest = semver.maxSatisfying(tags, "*");
+    return latest && semver.clean(latest);
+  } catch {
+    return null;
+  }
+}
+
 function getWebsiteVersion(websiteStaging) {
   if (websiteStaging && process.env.GITHUB_REF_TYPE === "tag") {
     const refName = process.env.GITHUB_REF_NAME;
@@ -53,6 +66,7 @@ function getWebsiteSettings() {
 
   return {
     baseUrl,
+    latestRelease: getLatestRelease(),
     websiteNotLatest,
     websiteStaging,
     websiteVersion: getWebsiteVersion(websiteStaging),
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index 66bea05104..eb611a16e0 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -35,7 +35,7 @@ const {
 
 const repoAddress = "https://github.com/apache/opendal";;
 
-const { baseUrl, websiteNotLatest, websiteStaging, websiteVersion } =
+const { baseUrl, latestRelease, websiteNotLatest, websiteStaging, 
websiteVersion } =
   getWebsiteSettings();
 const localImages = require("./plugins/local-images")({
   siteDir: __dirname,
@@ -51,7 +51,7 @@ const config = {
 
   customFields: {
     isStaging: websiteStaging,
-    version: websiteVersion,
+    latestRelease,
   },
 
   url: "https://opendal.apache.org/";,
diff --git a/website/src/components/DownloadLink/index.js 
b/website/src/components/DownloadLink/index.js
index 1803a80d20..1b27a33201 100644
--- a/website/src/components/DownloadLink/index.js
+++ b/website/src/components/DownloadLink/index.js
@@ -17,39 +17,26 @@
  * under the License.
  */
 
-import React from 'react';
+import React from "react";
 import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
 import Link from "@docusaurus/Link";
 
-function SourceTarballUrl() {
-    const {
-        siteConfig: {customFields},
-    } = useDocusaurusContext();
-    const version = customFields.version;
-    const link = 
`https://www.apache.org/dyn/closer.lua/opendal/${version}/apache-opendal-core-${version}-src.tar.gz?action=download`;
-    return <Link to={link}>{version}</Link>
-}
-
-function SignatureUrl() {
-    const {
-        siteConfig: {customFields},
-    } = useDocusaurusContext();
-    const version = customFields.version;
-    const link = 
`https://downloads.apache.org/opendal/${version}/apache-opendal-core-${version}-src.tar.gz.asc`;
-    return <Link to={link}>asc</Link>
-}
+export default function DownloadLink() {
+  const { siteConfig } = useDocusaurusContext();
+  const version = siteConfig.customFields.latestRelease;
+  if (!version) {
+    return (
+      <Link to="https://downloads.apache.org/opendal/";>available from Apache 
Downloads</Link>
+    );
+  }
 
-function ChecksumUrl() {
-    const {
-        siteConfig: {customFields},
-    } = useDocusaurusContext();
-    const version = customFields.version;
-    const link = 
`https://downloads.apache.org/opendal/${version}/apache-opendal-core-${version}-src.tar.gz.sha512`;
-    return <Link to={link}>sha512</Link>
+  const artifact = `opendal/apache-opendal-core-${version}-src.tar.gz`;
+  const source = 
`https://www.apache.org/dyn/closer.lua/${artifact}?action=download`;
+  const download = `https://downloads.apache.org/${artifact}`;
+  return (
+    <>
+      <Link to={source}>{version}</Link>{" "}
+      (<Link to={`${download}.asc`}>asc</Link>, <Link 
to={`${download}.sha512`}>sha512</Link>)
+    </>
+  );
 }
-
-export default function DownloadLink() {
-    return <>
-        <SourceTarballUrl/> (<SignatureUrl/>, <ChecksumUrl/>)
-    </>;
-}
\ No newline at end of file

Reply via email to