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

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

commit 6f19861233723756f94a9f097b2b16d8158f1540
Author: tison <wander4...@gmail.com>
AuthorDate: Thu May 2 01:11:43 2024 +0800

    convey isStaging
    
    Signed-off-by: tison <wander4...@gmail.com>
---
 website/docusaurus.config.js                    | 10 +++++++
 website/package.json                            |  3 ++-
 website/pnpm-lock.yaml                          | 21 ++++++++-------
 website/src/components/DownloadLink/index.js    | 36 +++++++++++++++++++++++++
 website/src/pages/{download.md => download.mdx} |  6 ++---
 5 files changed, 62 insertions(+), 14 deletions(-)

diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index 988c8bbcc5..207739d1d5 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -26,6 +26,7 @@ const repoAddress = 'https://github.com/apache/opendal';
 
 const baseUrl = process.env.OPENDAL_WEBSITE_BASE_URL ? 
process.env.OPENDAL_WEBSITE_BASE_URL : '/';
 const websiteNotLatest = process.env.OPENDAL_WEBSITE_NOT_LATEST ? 
process.env.OPENDAL_WEBSITE_NOT_LATEST : false;
+const websiteStaging = process.env.OPENDAL_WEBSITE_STAGING ? 
process.env.OPENDAL_WEBSITE_STAGING : false;
 
 /** @type {import('@docusaurus/types').Config} */
 const config = {
@@ -33,6 +34,15 @@ const config = {
   tagline: 'Open Data Access Layer: Access data freely, painlessly, and 
efficiently',
   favicon: 'img/favicon.ico',
 
+  customFields: {
+    isStaging: websiteStaging,
+    version: (function () {
+      const semver = require('semver');
+      const version = semver.parse('v0.45.1-169-gc53c33065c', {});
+      return `${version.major}.${version.minor}.${version.patch}`;
+    })()
+  },
+
   url: 'https://opendal.apache.org/',
   baseUrl: '/',
 
diff --git a/website/package.json b/website/package.json
index 9c7fb47bad..ca73a4b834 100644
--- a/website/package.json
+++ b/website/package.json
@@ -24,7 +24,8 @@
     "lunr": "^2.3.9",
     "prism-react-renderer": "^1.3.5",
     "react": "^18",
-    "react-dom": "^18"
+    "react-dom": "^18",
+    "semver": "^7.6.0"
   },
   "devDependencies": {
     "@docusaurus/module-type-aliases": "^3.1"
diff --git a/website/pnpm-lock.yaml b/website/pnpm-lock.yaml
index 058857404e..a52b3ed00e 100644
--- a/website/pnpm-lock.yaml
+++ b/website/pnpm-lock.yaml
@@ -38,6 +38,9 @@ dependencies:
   react-dom:
     specifier: ^18
     version: 18.2.0(react@18.2.0)
+  semver:
+    specifier: ^7.6.0
+    version: 7.6.0
 
 devDependencies:
   '@docusaurus/module-type-aliases':
@@ -1610,7 +1613,7 @@ packages:
       react-router-config: 5.1.1(react-router@5.3.4)(react@18.2.0)
       react-router-dom: 5.3.4(react@18.2.0)
       rtl-detect: 1.1.2
-      semver: 7.5.4
+      semver: 7.6.0
       serve-handler: 6.1.5
       shelljs: 0.8.5
       terser-webpack-plugin: 5.3.9(webpack@5.89.0)
@@ -3955,7 +3958,7 @@ packages:
       postcss-modules-scope: 3.0.0(postcss@8.4.32)
       postcss-modules-values: 4.0.0(postcss@8.4.32)
       postcss-value-parser: 4.2.0
-      semver: 7.5.4
+      semver: 7.6.0
       webpack: 5.89.0
     dev: false
 
@@ -4808,7 +4811,7 @@ packages:
       memfs: 3.5.3
       minimatch: 3.1.2
       schema-utils: 2.7.0
-      semver: 7.5.4
+      semver: 7.6.0
       tapable: 1.1.3
       typescript: 5.3.3
       webpack: 5.89.0
@@ -6943,7 +6946,7 @@ packages:
       got: 12.6.1
       registry-auth-token: 5.0.2
       registry-url: 6.0.1
-      semver: 7.5.4
+      semver: 7.6.0
     dev: false
 
   /param-case@3.0.4:
@@ -7186,7 +7189,7 @@ packages:
       cosmiconfig: 8.3.6(typescript@5.3.3)
       jiti: 1.21.0
       postcss: 8.4.32
-      semver: 7.5.4
+      semver: 7.6.0
       webpack: 5.89.0
     transitivePeerDependencies:
       - typescript
@@ -8180,7 +8183,7 @@ packages:
     resolution: {integrity: 
sha512-0Ju4+6A8iOnpL/Thra7dZsSlOHYAHIeMxfhWQRI1/VLcT3WDBZKKtQt/QkBOsiIN9ZpuvHE6cGZ0x4glCMmfiA==}
     engines: {node: '>=12'}
     dependencies:
-      semver: 7.5.4
+      semver: 7.6.0
     dev: false
 
   /semver@6.3.1:
@@ -8188,8 +8191,8 @@ packages:
     hasBin: true
     dev: false
 
-  /semver@7.5.4:
-    resolution: {integrity: 
sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==}
+  /semver@7.6.0:
+    resolution: {integrity: 
sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==}
     engines: {node: '>=10'}
     hasBin: true
     dependencies:
@@ -8901,7 +8904,7 @@ packages:
       is-yarn-global: 0.4.1
       latest-version: 7.0.0
       pupa: 3.1.0
-      semver: 7.5.4
+      semver: 7.6.0
       semver-diff: 4.0.0
       xdg-basedir: 5.1.0
     dev: false
diff --git a/website/src/components/DownloadLink/index.js 
b/website/src/components/DownloadLink/index.js
new file mode 100644
index 0000000000..cdcf304225
--- /dev/null
+++ b/website/src/components/DownloadLink/index.js
@@ -0,0 +1,36 @@
+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}>0.45.1</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>
+}
+
+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>
+}
+
+export default function DownloadLink() {
+    return <>
+        <SourceTarballUrl/> (<SignatureUrl/>, <ChecksumUrl/>)
+    </>;
+}
\ No newline at end of file
diff --git a/website/src/pages/download.md b/website/src/pages/download.mdx
similarity index 78%
rename from website/src/pages/download.md
rename to website/src/pages/download.mdx
index 13429cd335..5d4b7dc59d 100644
--- a/website/src/pages/download.md
+++ b/website/src/pages/download.mdx
@@ -4,11 +4,9 @@ The official Apache OpenDAL releases are provided as source 
artifacts.
 
 ## Releases
 
-The latest source release is [0.45.1][source-link] ([asc][asc-link], 
[sha512][sha512-link]).
+import DownloadLink from '@site/src/components/DownloadLink';
 
-[source-link]: 
https://www.apache.org/dyn/closer.lua/opendal/0.45.1/apache-opendal-core-0.45.1-src.tar.gz?action=download
-[asc-link]: 
https://downloads.apache.org/opendal/0.45.1/apache-opendal-core-0.45.1-src.tar.gz.asc
-[sha512-link]: 
https://downloads.apache.org/opendal/0.45.1/apache-opendal-core-0.45.1-src.tar.gz.sha512
+The latest source release is <DownloadLink/>.
 
 For older releases, please check the 
[archive](https://archive.apache.org/dist/opendal/).
 

Reply via email to