Skip to content

chore: Update the sidebar structure and document version #150

chore: Update the sidebar structure and document version

chore: Update the sidebar structure and document version #150

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout linglong old version
run: |
# 定义版本和 commit 的映射关系
declare -A dict=(
["1.5.x"]="fd4ccd143d7e67b5c19cba3987043ae7db012ca8"
# 添加更多的版本和 commit
)
# 遍历字典并检出每个 commit 到对应的目录
for version in "${!dict[@]}"; do
commit="${dict[$version]}"
# 克隆仓库到指定版本的目录下,使用一个临时分支名
git clone https://github.com/OpenAtom-Linyaps/linyaps.git $version
cd $version
git sparse-checkout init
git sparse-checkout set docs/pages/en docs/pages/guide
git checkout $commit
mv docs/pages/en .
mv docs/pages/guide .
# 输出目录内容,确认文件是否被正确检出
cd ..
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout linglong release
uses: actions/checkout@v4
with:
ref: 294988fe388c4d7d82196fc5eb5dce6edcaf7772 # 指定玲珑项目的 commit 提交,可能文档有小部分修改,不需要从 tag 获取
path: tmp
repository: OpenAtom-Linyaps/linyaps
sparse-checkout: |
docs/pages
sparse-checkout-cone-mode: false
- name: set release version
run: |
rm -rf en guide
mv tmp/docs/pages/guide .
mv tmp/docs/pages/en .
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "yarn"
- name: Install Depend
run: yarn install
- name: Build Pages
run: yarn build
- name: Upload Artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./.vitepress/dist
deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1