You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/12/14 15:04:45 UTC

(incubator-opendal) branch main updated: docs(website): polish deploy to nightlies (#3753)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 0f19defa5 docs(website): polish deploy to nightlies (#3753)
0f19defa5 is described below

commit 0f19defa54cc87716f4cf9523e9a0a74cbac2558
Author: Suyan <su...@gmail.com>
AuthorDate: Thu Dec 14 23:04:40 2023 +0800

    docs(website): polish deploy to nightlies (#3753)
    
    * docs(website): polish deploy to nightlies
    
    Signed-off-by: suyanhanx <su...@gmail.com>
    
    * Update docs.yml
    
    * Update docs.yml
    
    * revert to normal using
    
    Signed-off-by: suyanhanx <su...@gmail.com>
    
    * update env name
    
    Signed-off-by: suyanhanx <su...@gmail.com>
    
    * append
    
    Signed-off-by: suyanhanx <su...@gmail.com>
    
    * slash
    
    Signed-off-by: suyanhanx <su...@gmail.com>
    
    ---------
    
    Signed-off-by: suyanhanx <su...@gmail.com>
    Co-authored-by: Xuanwo <gi...@xuanwo.io>
---
 .github/workflows/docs.yml   | 28 ++++++++++++++++++++++++----
 website/.yarnrc.yml          | 19 -------------------
 website/docusaurus.config.js | 18 +++++++++++++++++-
 3 files changed, 41 insertions(+), 24 deletions(-)

diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 55a0c6387..17ddc9bb5 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -383,25 +383,45 @@ jobs:
           publish_dir: website/build
           publish_branch: gh-pages
 
+      - name: Clear build
+        run: rm -rf ./website/build
+
+      - name: Build for nightlies with tagged version
+        working-directory: website
+        run: pnpm build
+        env:
+          # Keep this same with the remote_path below
+          OPENDAL_WEBSITE_BASE_URL: /opendal/opendal-docs-release-${{ github.ref_name }}/
+          OPENDAL_WEBSITE_NOT_LATEST: true
+
       - name: Deploy to nightlies for tagged version
         uses: burnett01/rsync-deployments@5.2
         if: "startsWith(github.ref, 'refs/tags/')"
         with:
           switches: -avzr
-          path: website/build/*
-          remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/opendal/opendal-docs-release-${{ github.ref_name }}
+          path: website/build/
+          remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/opendal/opendal-docs-release-${{ github.ref_name }}/
           remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}
           remote_port: ${{ secrets.NIGHTLIES_RSYNC_PORT }}
           remote_user: ${{ secrets.NIGHTLIES_RSYNC_USER }}
           remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }}
 
+      - name: Clear build
+        run: rm -rf ./website/build
+
+      - name: Build for nightlies with stable version
+        working-directory: website
+        run: pnpm build
+        env:
+          OPENDAL_WEBSITE_BASE_URL: /opendal/opendal-docs-stable/
+
       - name: Deploy to nightlies for stable version
         uses: burnett01/rsync-deployments@5.2
         if: "startsWith(github.ref, 'refs/tags/')"
         with:
           switches: -avzr --delete
-          path: website/build/*
-          remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/opendal/opendal-docs-stable
+          path: website/build/
+          remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/opendal/opendal-docs-stable/
           remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}
           remote_port: ${{ secrets.NIGHTLIES_RSYNC_PORT }}
           remote_user: ${{ secrets.NIGHTLIES_RSYNC_USER }}
diff --git a/website/.yarnrc.yml b/website/.yarnrc.yml
deleted file mode 100644
index 74d3bd6c5..000000000
--- a/website/.yarnrc.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-nodeLinker: node-modules
-
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index e12fd3800..d1a6b8827 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -24,6 +24,9 @@ const lightCodeTheme = require('prism-react-renderer/themes/github');
 const darkCodeTheme = require('prism-react-renderer/themes/dracula');
 const repoAddress = 'https://github.com/apache/incubator-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;
+
 /** @type {import('@docusaurus/types').Config} */
 const config = {
   title: 'Apache OpenDAL',
@@ -228,4 +231,17 @@ const config = {
     }),
 };
 
-module.exports = config;
+function generateConfig() {
+  config.baseUrl = baseUrl
+
+  if (websiteNotLatest) {
+    config.themeConfig.announcementBar = {
+      id: 'announcementBar-0', // Increment on change
+      content: 'You are viewing the documentation of a <strong>historical release</strong>. <a href="https://nightlies.apache.org/opendal/opendal-docs-stable/">View the latest stable release</a>.',
+    }
+  }
+
+  return config
+}
+
+module.exports = generateConfig();