Skip to content

Commit

Permalink
chore: checkout old version
Browse files Browse the repository at this point in the history
更新工作流切出旧版本的文档。

Log: update docs
  • Loading branch information
chenchongbiao committed Jul 8, 2024
1 parent 085eaf7 commit cdfcec2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
35 changes: 23 additions & 12 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,31 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["1.5.0"] # 定义版本数组
steps:
- uses: actions/checkout@v3
- name: Checkout linglong ${{ matrix.version }}
uses: actions/checkout@v4
with:
ref: ${{ matrix.version }} # 使用矩阵中的版本号作为检出的ref
path: ${{ matrix.version }} # 每个版本检出到不同的目录
repository: OpenAtomFoundation/linglong
sparse-checkout: |
docs/pages
sparse-checkout-cone-mode: false
- name: Checkout linglong old version
run: |
# 定义版本和 commit 的映射关系
declare -A dict=(
["1.5.0"]="317ef66813e413adafeae5b01186b34eda514248"
# 添加更多的版本和 commit
)
# 遍历字典并检出每个 commit 到对应的目录
for version in "${!dict[@]}"; do
commit="${dict[$version]}"
# 克隆仓库到指定版本的目录下,使用一个临时分支名
git clone https://github.com/OpenAtomFoundation/linglong.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:
Expand Down
4 changes: 2 additions & 2 deletions .vitepress/theme/versions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function generateVersions() {
const versions = ['']; // 保留空用来判断默认路由
const versions = ['', "1.5.0"]; // 保留空用来判断默认路由
return {
defaultVersion: '1.5.0', // 默认显示版本号
defaultVersion: '1.5.6', // 默认显示版本号
versions: versions
};
}

0 comments on commit cdfcec2

Please sign in to comment.