Skip to content

Commit

Permalink
docs(website): polish deploy to nightlies (#3753)
Browse files Browse the repository at this point in the history
* docs(website): polish deploy to nightlies

Signed-off-by: suyanhanx <[email protected]>

* Update docs.yml

* Update docs.yml

* revert to normal using

Signed-off-by: suyanhanx <[email protected]>

* update env name

Signed-off-by: suyanhanx <[email protected]>

* append

Signed-off-by: suyanhanx <[email protected]>

* slash

Signed-off-by: suyanhanx <[email protected]>

---------

Signed-off-by: suyanhanx <[email protected]>
Co-authored-by: Xuanwo <[email protected]>
  • Loading branch information
suyanhanx and Xuanwo authored Dec 14, 2023
1 parent 3741397 commit 0f19def
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 24 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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/[email protected]
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 }}
Expand Down
19 changes: 0 additions & 19 deletions website/.yarnrc.yml

This file was deleted.

18 changes: 17 additions & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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();

0 comments on commit 0f19def

Please sign in to comment.