Skip to content

fix versioned sidebar i18n does not work (#54) #185

fix versioned sidebar i18n does not work (#54)

fix versioned sidebar i18n does not work (#54) #185

Workflow file for this run

name: Check, render and publish docs
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
main-release-for-github-pages:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "yarn"
cache-dependency-path: "./yarn.lock"
- name: Install yarn
run: npm install -g yarn
- name: Get yarn cache directory path
id: yarn-cache-docs-dir-path
run: |
echo "::set-output name=dir::"
yarn cache dir
- uses: actions/cache@v3
id: yarn-cache-docs
with:
path: |
${{ steps.yarn-cache-docs-dir-path.outputs.dir }}
**/node_modules
key: ${{ runner.os }}-yarn-docs-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-docs-
- name: Install docs dependencies
if: steps.yarn-cache-docs.outputs.cache-hit != 'true' # Over here!
run: make install-req
- name: Checkout gh-pages branch for archived versions docs
uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages
sparse-checkout: |
.archived-versions
- name: Copy archived version files
run: |
[ ! -d gh-pages/.archived-versions ] && exit 0
cp gh-pages/.archived-versions/versions.json ./
cp -R gh-pages/.archived-versions/versioned_sidebars ./
cp -R gh-pages/.archived-versions/versioned_docs ./
cp -R gh-pages/.archived-versions/i18n/zh/docusaurus-plugin-content-docs/version-* ./i18n/zh/docusaurus-plugin-content-docs/
- name: Lint docs
run: make lint-docs
- name: Build docs
run: make build-docs
- name: Update archived version files
if: ${{ github.ref == 'refs/heads/main'}}
run: |
mkdir -p build/.archived-versions
cp versions.json build/.archived-versions/
cp -R versioned_sidebars build/.archived-versions/
cp -R versioned_docs build/.archived-versions/
mkdir -p build/.archived-versions/i18n/zh/docusaurus-plugin-content-docs
cp -R i18n/zh/docusaurus-plugin-content-docs/version-* build/.archived-versions/i18n/zh/docusaurus-plugin-content-docs/
- name: Publish to Github Pages
if: ${{ github.ref == 'refs/heads/main'}}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
user_name: github-actions[bot]
cname: doc.starwhale.ai
user_email: "github-actions[bot]@users.noreply.github.com"
main-release-for-starwhale-cn:
runs-on: self-hosted
needs:
- main-release-for-github-pages
if: ${{ github.ref == 'refs/heads/main'}}
steps:
- uses: actions/checkout@v3
- name: Install docs dependencies
run: |
yarn config set registry https://registry.npmmirror.com
npm config set registry https://registry.npm.taobao.org
make install-req
- name: Checkout gh-pages branch for archived versions docs
uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages
sparse-checkout: |
.archived-versions
- name: Copy archived version files
run: |
[ ! -d gh-pages/.archived-versions ] && exit 0
cp gh-pages/.archived-versions/versions.json ./
cp -R gh-pages/.archived-versions/versioned_sidebars ./
cp -R gh-pages/.archived-versions/versioned_docs ./
cp -R gh-pages/.archived-versions/i18n/zh/docusaurus-plugin-content-docs/version-* ./i18n/zh/docusaurus-plugin-content-docs/
- name: Build docs
run: make build-docs
env:
DEFAULT_LOCALE: "zh"
URL: "https://starwhale.cn"
ORG: "starwhale.cn"
BASE_URL: "/docs/"
- name: Publish docs
uses: appleboy/scp-action@v0.1.4
with:
debug: true
host: ${{ secrets.DOC_RELEASE_HOST }}
username: ${{ secrets.DOC_RELEASE_USER }}
key: ${{ secrets.DOC_RELEASE_KEY }}
source: "build/*"
target: "/data/www/starwhale-cn-docs/docs/"
strip_components: 1
rm: true