From f89fb1496a2fe60b9af3bbdb73858d52d31ed1da Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 19:18:05 +0800 Subject: [PATCH 01/13] ci: Fix issue of clearing all docs versions --- .github/workflows/deploy-docs-latest.yml | 6 ++---- .github/workflows/deploy-docs-stable.yml | 20 +++++--------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.github/workflows/deploy-docs-latest.yml b/.github/workflows/deploy-docs-latest.yml index 4740682..fbf347a 100644 --- a/.github/workflows/deploy-docs-latest.yml +++ b/.github/workflows/deploy-docs-latest.yml @@ -56,10 +56,8 @@ jobs: git clone -b master https://${{ secrets.GH_PAT }}@github.com/FrozenLemonTee/original_docs.git deploy-repo cd deploy-repo - # Clean up old files (keep the .git directory) - find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name 'CNAME' -exec rm -rf {} + 2>/dev/null || true - - # Copy the new document to directory latest + # Only update latest directory + rm -rf latest mkdir -p latest cp -r ../../original_docs/docs/html/* latest/ diff --git a/.github/workflows/deploy-docs-stable.yml b/.github/workflows/deploy-docs-stable.yml index 5f4685a..2a0d29a 100644 --- a/.github/workflows/deploy-docs-stable.yml +++ b/.github/workflows/deploy-docs-stable.yml @@ -78,20 +78,10 @@ jobs: cd deploy-repo - # Clean up old files (keep the .git directory) - find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name 'CNAME' -exec rm -rf {} + 2>/dev/null || true - - if [[ "${{ steps.version.outputs.is-tag }}" == "true" ]]; then - # Tag Version: Create Version Directory - mkdir -p versions/${{ steps.version.outputs.docs-version }} - cp -r ../../original_docs/docs/html/* versions/${{ steps.version.outputs.docs-version }}/ - echo "Deployed tag version: ${{ steps.version.outputs.docs-version }}" - else - # Branch master: update stable version - mkdir -p stable - cp -r ../../original_docs/docs/html/* stable/ - echo "Deployed stable version from master" - fi + # Only update stable directory + rm -rf stable + mkdir -p stable + cp -r ../../original_docs/docs/html/* stable/ # Create index.html redirection echo '' > index.html @@ -117,5 +107,5 @@ jobs: else git commit -m "Deploy ${{ steps.version.outputs.docs-version }} documentation from ${{ github.sha }}" git push origin master - echo "Documentation deployed successfully" + echo "✅ Stable documentation deployed successfully" fi \ No newline at end of file From 52b12e68da187a9340d58fbc1f204e6d5f6d2cd1 Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 19:18:47 +0800 Subject: [PATCH 02/13] ci: Remove tag deploy logic --- .github/workflows/deploy-docs-stable.yml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy-docs-stable.yml b/.github/workflows/deploy-docs-stable.yml index 2a0d29a..de80ca9 100644 --- a/.github/workflows/deploy-docs-stable.yml +++ b/.github/workflows/deploy-docs-stable.yml @@ -4,8 +4,7 @@ name: Deploy Documentation - Stable on: push: - branches: [ master ] - tags: [ 'v*' ] + branches: [ master, test ] # Temporary add test branch to deploy list jobs: build-and-deploy: @@ -17,19 +16,6 @@ jobs: with: fetch-depth: 0 - - name: Determine documentation version - id: version - run: | - if [[ $GITHUB_REF == refs/tags/* ]]; then - TAG=${GITHUB_REF#refs/tags/} - echo "docs-version=$TAG" >> $GITHUB_OUTPUT - echo "is-tag=true" >> $GITHUB_OUTPUT - else - echo "docs-version=stable" >> $GITHUB_OUTPUT - echo "is-tag=false" >> $GITHUB_OUTPUT - fi - echo "Version: ${{ steps.version.outputs.docs-version }}" - - name: Install dependencies run: | sudo apt-get update @@ -58,8 +44,8 @@ jobs: echo '' >> ../original_docs/docs/html/version.html echo '' >> ../original_docs/docs/html/version.html echo '

Documentation Version

' >> ../original_docs/docs/html/version.html - echo "

Version: ${{ steps.version.outputs.docs-version }}

" >> ../original_docs/docs/html/version.html - echo '

Branch: master

' >> ../original_docs/docs/html/version.html + echo '

Version: stable

' >> ../original_docs/docs/html/version.html + echo '

Branch: master

' >> index.html echo "

Build Date: $(date -u)

" >> ../original_docs/docs/html/version.html echo "

Commit: ${{ github.sha }}

" >> ../original_docs/docs/html/version.html echo '' >> ../original_docs/docs/html/version.html From 7d828855e466247f702f585d02a0f983187cd7c2 Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 19:19:19 +0800 Subject: [PATCH 03/13] ci: Remove redundant workflow logics --- .github/workflows/basic-tests.yml | 2 -- .github/workflows/full-tests.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/basic-tests.yml b/.github/workflows/basic-tests.yml index 7bc7234..cd7de7d 100644 --- a/.github/workflows/basic-tests.yml +++ b/.github/workflows/basic-tests.yml @@ -5,8 +5,6 @@ name: Test Branch CI - Basic Tests on: push: branches: [ test ] - pull_request: - branches: [ test ] jobs: build-and-test: diff --git a/.github/workflows/full-tests.yml b/.github/workflows/full-tests.yml index 6d6331c..79ca7db 100644 --- a/.github/workflows/full-tests.yml +++ b/.github/workflows/full-tests.yml @@ -3,8 +3,6 @@ name: Master Branch CI - Full Tests on: - push: - branches: [ master ] pull_request: branches: [ master ] From 1d51aa7036ccbc613f5b66d7007ce722344b89a0 Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 19:19:39 +0800 Subject: [PATCH 04/13] ci: Add deploy-docs-tags.yml --- .github/workflows/deploy-docs-tags.yml | 139 +++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 .github/workflows/deploy-docs-tags.yml diff --git a/.github/workflows/deploy-docs-tags.yml b/.github/workflows/deploy-docs-tags.yml new file mode 100644 index 0000000..c56feac --- /dev/null +++ b/.github/workflows/deploy-docs-tags.yml @@ -0,0 +1,139 @@ +# .github/workflows/deploy-docs-tags.yml + +name: Deploy Documentation - Tag Versions + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract version from tag + id: version + run: | + VERSION=${GITHUB_REF#refs/tags/v} + echo "docs-version=$VERSION" >> $GITHUB_OUTPUT + echo "Detected version: $VERSION" + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y doxygen graphviz plantuml + + - name: Build documentation + run: | + # Create the necessary directory structure + mkdir -p ../original_docs + + # Run doxygen + doxygen Doxyfile + + # Check whether the document was generated successfully + if [ ! -d "../original_docs/docs/html" ]; then + echo "Error: Documentation was not generated in expected location" + ls -la ../original_docs/docs/ || echo "Docs directory not found" + exit 1 + fi + + # Create version information file + echo '' > ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo ' Version Info' >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '

Documentation Version

' >> ../original_docs/docs/html/version.html + echo "

Version: ${{ steps.version.outputs.docs-version }}

" >> ../original_docs/docs/html/version.html + echo "

Tag: ${{ github.ref_name }}

" >> ../original_docs/docs/html/version.html + echo "

Build Date: $(date -u)

" >> ../original_docs/docs/html/version.html + echo "

Commit: ${{ github.sha }}

" >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + + - name: Deploy to original_docs repository + env: + GH_PAT: ${{ secrets.GH_PAT }} + run: | + # Configure git + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + # Clone document repository + git clone -b master https://${{ secrets.GH_PAT }}@github.com/FrozenLemonTee/original_docs.git deploy-repo + cd deploy-repo + + # Create versions directory if it doesn't exist + mkdir -p versions + + # Update specific version directory + VERSION_DIR="versions/${{ steps.version.outputs.docs-version }}" + rm -rf "$VERSION_DIR" + mkdir -p "$VERSION_DIR" + cp -r ../../original_docs/docs/html/* "$VERSION_DIR"/ + + # Update main index.html to include this version + echo '' > index.html + echo '' >> index.html + echo '' >> index.html + echo ' ' >> index.html + echo '' >> index.html + echo '' >> index.html + echo '

Redirecting to stable documentation...

' >> index.html + echo '

Available versions:

' >> index.html + echo ' ' >> index.html + echo '

Recent tag versions:

' >> index.html + echo '
    ' >> index.html + + # List recent tag versions (last 5) + for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r | head -5); do + echo "
  • Version $dir
  • " >> index.html + done + + echo '
' >> index.html + echo '' >> index.html + echo '' >> index.html + + # Create versions/index.html to list all available versions + echo '' > versions/index.html + echo '' >> versions/index.html + echo '' >> versions/index.html + echo ' Versioned Documentation' >> versions/index.html + echo '' >> versions/index.html + echo '' >> versions/index.html + echo '

Versioned Documentation

' >> versions/index.html + echo '

Select a version:

' >> versions/index.html + echo '
    ' >> versions/index.html + + # List all versions in reverse order (newest first) + for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r); do + echo "
  • Version $dir
  • " >> versions/index.html + done + + echo '
' >> versions/index.html + echo '

Stable (master branch)

' >> versions/index.html + echo '

Latest (test branch)

' >> versions/index.html + echo '' >> versions/index.html + echo '' >> versions/index.html + + # Submit and push + git add . + if git diff-index --quiet HEAD --; then + echo "No changes to deploy" + else + git commit -m "Deploy ${{ steps.version.outputs.docs-version }} documentation from tag ${{ github.ref_name }}" + git push origin master + echo "✅ Tag documentation version ${{ steps.version.outputs.docs-version }} deployed successfully" + fi \ No newline at end of file From 79105cc71bb159294d28eb0d126036dcc1869f4e Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 19:19:47 +0800 Subject: [PATCH 05/13] ci: Add deploy-docs-existing-tags.yml.yml --- .../workflows/deploy-docs-existing-tags.yml | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 .github/workflows/deploy-docs-existing-tags.yml diff --git a/.github/workflows/deploy-docs-existing-tags.yml b/.github/workflows/deploy-docs-existing-tags.yml new file mode 100644 index 0000000..a89965a --- /dev/null +++ b/.github/workflows/deploy-docs-existing-tags.yml @@ -0,0 +1,168 @@ +# .github/workflows/deploy-docs-existing-tags.yml +# Temporary workflow to deploying docs for existing tags + +name: Deploy Documentation - Existing Tags + +on: + workflow_dispatch: + inputs: + tags: + description: '要生成文档的标签列表(空格分隔,如 v1.0.0 v1.1.0),留空则处理所有标签' + required: false + default: '' + +jobs: + deploy-existing-tags: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get tags to process + id: get-tags + run: | + # 获取所有符合条件的标签 + if [ -n "${{ github.event.inputs.tags }}" ]; then + # 使用用户指定的标签 + TAGS="${{ github.event.inputs.tags }}" + echo "Using specified tags: $TAGS" + else + # 获取所有 v*.*.* 格式的标签 + TAGS=$(git tag -l "v*.*.*" | sort -V -r) + echo "Using all v*.*.* tags: $TAGS" + fi + + # 将标签列表转换为JSON数组格式 + TAGS_JSON=$(echo "$TAGS" | jq -R -s -c 'split("\n") | map(select(. != ""))') + echo "tags=$TAGS_JSON" >> $GITHUB_OUTPUT + + - name: Process each tag + env: + GH_PAT: ${{ secrets.GH_PAT }} + TAGS_JSON: ${{ steps.get-tags.outputs.tags }} + run: | + # 安装 jq 用于 JSON 解析 + sudo apt-get update + sudo apt-get install -y jq doxygen graphviz plantuml + + # 配置 git + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + # 克隆文档仓库 + git clone -b master https://$GH_PAT@github.com/FrozenLemonTee/original_docs.git deploy-repo + + # 解析标签数组 + TAGS_ARRAY=$(echo "$TAGS_JSON" | jq -r '.[]') + + for TAG in $TAGS_ARRAY; do + echo "Processing tag: $TAG" + + # 检出特定标签 + git checkout $TAG + + # 提取版本号(移除 v 前缀) + VERSION=${TAG#v} + echo "Version: $VERSION" + + # 构建文档 + mkdir -p ../original_docs + doxygen Doxyfile + + if [ ! -d "../original_docs/docs/html" ]; then + echo "Warning: Documentation was not generated for tag $TAG" + continue + fi + + # 创建版本信息文件 + echo '' > ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo ' Version Info' >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '

Documentation Version

' >> ../original_docs/docs/html/version.html + echo "

Version: $VERSION

" >> ../original_docs/docs/html/version.html + echo "

Tag: $TAG

" >> ../original_docs/docs/html/version.html + echo "

Build Date: $(date -u)

" >> ../original_docs/docs/html/version.html + echo "

Commit: $(git rev-parse $TAG)

" >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + + # 部署到文档仓库 + cd deploy-repo + + # 创建版本目录 + mkdir -p versions + VERSION_DIR="versions/$VERSION" + rm -rf "$VERSION_DIR" + mkdir -p "$VERSION_DIR" + cp -r ../original_docs/docs/html/* "$VERSION_DIR"/ + + # 回到工作目录继续处理下一个标签 + cd .. + done + + # 更新导航页面 + cd deploy-repo + + # 更新主 index.html + echo '' > index.html + echo '' >> index.html + echo '' >> index.html + echo ' ' >> index.html + echo '' >> index.html + echo '' >> index.html + echo '

Redirecting to stable documentation...

' >> index.html + echo '

Available versions:

' >> index.html + echo ' ' >> index.html + echo '

Recent tag versions:

' >> index.html + echo '
    ' >> index.html + + # 列出最近5个版本 + for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r | head -5); do + echo "
  • Version $dir
  • " >> index.html + done + + echo '
' >> index.html + echo '' >> index.html + echo '' >> index.html + + # 创建 versions/index.html + echo '' > versions/index.html + echo '' >> versions/index.html + echo '' >> versions/index.html + echo ' Versioned Documentation' >> versions/index.html + echo '' >> versions/index.html + echo '' >> versions/index.html + echo '

Versioned Documentation

' >> versions/index.html + echo '

Select a version:

' >> versions/index.html + echo '
    ' >> versions/index.html + + # 列出所有版本 + for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r); do + echo "
  • Version $dir
  • " >> versions/index.html + done + + echo '
' >> versions/index.html + echo '

Stable (master branch)

' >> versions/index.html + echo '

Latest (test branch)

' >> versions/index.html + echo '' >> versions/index.html + echo '' >> versions/index.html + + # 提交更改 + git add . + if git diff-index --quiet HEAD --; then + echo "No changes to deploy" + else + git commit -m "Deploy documentation for existing tags" + git push origin master + echo "✅ Existing tags documentation deployed successfully" + fi \ No newline at end of file From b0366afdc55024cd4299a9186e4ecf379764a15b Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 19:48:44 +0800 Subject: [PATCH 06/13] ci: Deploy docs of v0.1.0 v0.1.2 v0.1.4 --- .../workflows/deploy-docs-existing-tags.yml | 119 +++--------------- 1 file changed, 17 insertions(+), 102 deletions(-) diff --git a/.github/workflows/deploy-docs-existing-tags.yml b/.github/workflows/deploy-docs-existing-tags.yml index a89965a..2975dd8 100644 --- a/.github/workflows/deploy-docs-existing-tags.yml +++ b/.github/workflows/deploy-docs-existing-tags.yml @@ -1,74 +1,51 @@ # .github/workflows/deploy-docs-existing-tags.yml -# Temporary workflow to deploying docs for existing tags - name: Deploy Documentation - Existing Tags +# 直接在 test 分支 push 时触发 on: - workflow_dispatch: - inputs: - tags: - description: '要生成文档的标签列表(空格分隔,如 v1.0.0 v1.1.0),留空则处理所有标签' - required: false - default: '' + push: + branches: + - test jobs: deploy-existing-tags: runs-on: ubuntu-latest - + steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Get tags to process - id: get-tags + - name: Set tags to deploy + id: set-tags run: | - # 获取所有符合条件的标签 - if [ -n "${{ github.event.inputs.tags }}" ]; then - # 使用用户指定的标签 - TAGS="${{ github.event.inputs.tags }}" - echo "Using specified tags: $TAGS" - else - # 获取所有 v*.*.* 格式的标签 - TAGS=$(git tag -l "v*.*.*" | sort -V -r) - echo "Using all v*.*.* tags: $TAGS" - fi - - # 将标签列表转换为JSON数组格式 - TAGS_JSON=$(echo "$TAGS" | jq -R -s -c 'split("\n") | map(select(. != ""))') - echo "tags=$TAGS_JSON" >> $GITHUB_OUTPUT + # 一次性部署的指定 tags + TAGS="v0.1.0 v0.1.2 v0.1.4" + echo "tags=$TAGS" >> $GITHUB_OUTPUT - name: Process each tag env: GH_PAT: ${{ secrets.GH_PAT }} - TAGS_JSON: ${{ steps.get-tags.outputs.tags }} + TAGS: ${{ steps.set-tags.outputs.tags }} run: | - # 安装 jq 用于 JSON 解析 sudo apt-get update sudo apt-get install -y jq doxygen graphviz plantuml - # 配置 git git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" # 克隆文档仓库 git clone -b master https://$GH_PAT@github.com/FrozenLemonTee/original_docs.git deploy-repo - # 解析标签数组 - TAGS_ARRAY=$(echo "$TAGS_JSON" | jq -r '.[]') - - for TAG in $TAGS_ARRAY; do + for TAG in $TAGS; do echo "Processing tag: $TAG" # 检出特定标签 git checkout $TAG - # 提取版本号(移除 v 前缀) + # 提取版本号 VERSION=${TAG#v} - echo "Version: $VERSION" - - # 构建文档 mkdir -p ../original_docs doxygen Doxyfile @@ -80,89 +57,27 @@ jobs: # 创建版本信息文件 echo '' > ../original_docs/docs/html/version.html echo '' >> ../original_docs/docs/html/version.html - echo '' >> ../original_docs/docs/html/version.html - echo ' Version Info' >> ../original_docs/docs/html/version.html - echo '' >> ../original_docs/docs/html/version.html + echo 'Version Info' >> ../original_docs/docs/html/version.html echo '' >> ../original_docs/docs/html/version.html - echo '

Documentation Version

' >> ../original_docs/docs/html/version.html echo "

Version: $VERSION

" >> ../original_docs/docs/html/version.html - echo "

Tag: $TAG

" >> ../original_docs/docs/html/version.html - echo "

Build Date: $(date -u)

" >> ../original_docs/docs/html/version.html - echo "

Commit: $(git rev-parse $TAG)

" >> ../original_docs/docs/html/version.html echo '' >> ../original_docs/docs/html/version.html - echo '' >> ../original_docs/docs/html/version.html # 部署到文档仓库 cd deploy-repo - - # 创建版本目录 mkdir -p versions VERSION_DIR="versions/$VERSION" rm -rf "$VERSION_DIR" mkdir -p "$VERSION_DIR" cp -r ../original_docs/docs/html/* "$VERSION_DIR"/ - - # 回到工作目录继续处理下一个标签 cd .. done - # 更新导航页面 - cd deploy-repo - - # 更新主 index.html - echo '' > index.html - echo '' >> index.html - echo '' >> index.html - echo ' ' >> index.html - echo '' >> index.html - echo '' >> index.html - echo '

Redirecting to stable documentation...

' >> index.html - echo '

Available versions:

' >> index.html - echo ' ' >> index.html - echo '

Recent tag versions:

' >> index.html - echo '
    ' >> index.html - - # 列出最近5个版本 - for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r | head -5); do - echo "
  • Version $dir
  • " >> index.html - done - - echo '
' >> index.html - echo '' >> index.html - echo '' >> index.html - - # 创建 versions/index.html - echo '' > versions/index.html - echo '' >> versions/index.html - echo '' >> versions/index.html - echo ' Versioned Documentation' >> versions/index.html - echo '' >> versions/index.html - echo '' >> versions/index.html - echo '

Versioned Documentation

' >> versions/index.html - echo '

Select a version:

' >> versions/index.html - echo '
    ' >> versions/index.html - - # 列出所有版本 - for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r); do - echo "
  • Version $dir
  • " >> versions/index.html - done - - echo '
' >> versions/index.html - echo '

Stable (master branch)

' >> versions/index.html - echo '

Latest (test branch)

' >> versions/index.html - echo '' >> versions/index.html - echo '' >> versions/index.html - # 提交更改 + cd deploy-repo git add . if git diff-index --quiet HEAD --; then echo "No changes to deploy" else - git commit -m "Deploy documentation for existing tags" + git commit -m "Deploy documentation for v0.1.0, v0.1.2, v0.1.4" git push origin master - echo "✅ Existing tags documentation deployed successfully" - fi \ No newline at end of file + fi From 4dc0352a8ddf504fbf6771996783e90460e64364 Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 19:59:09 +0800 Subject: [PATCH 07/13] ci: Fix path error --- .../workflows/deploy-docs-existing-tags.yml | 91 +++++++++++++------ 1 file changed, 62 insertions(+), 29 deletions(-) diff --git a/.github/workflows/deploy-docs-existing-tags.yml b/.github/workflows/deploy-docs-existing-tags.yml index 2975dd8..2f942f5 100644 --- a/.github/workflows/deploy-docs-existing-tags.yml +++ b/.github/workflows/deploy-docs-existing-tags.yml @@ -1,14 +1,13 @@ # .github/workflows/deploy-docs-existing-tags.yml name: Deploy Documentation - Existing Tags -# 直接在 test 分支 push 时触发 on: push: branches: - - test + - test # 监听 test 分支 push jobs: - deploy-existing-tags: + build-and-deploy: runs-on: ubuntu-latest steps: @@ -17,67 +16,101 @@ jobs: with: fetch-depth: 0 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y doxygen graphviz plantuml jq + - name: Set tags to deploy - id: set-tags + id: tags run: | # 一次性部署的指定 tags TAGS="v0.1.0 v0.1.2 v0.1.4" echo "tags=$TAGS" >> $GITHUB_OUTPUT + echo "Deploying tags: $TAGS" - - name: Process each tag + - name: Build and deploy documentation env: GH_PAT: ${{ secrets.GH_PAT }} - TAGS: ${{ steps.set-tags.outputs.tags }} + TAGS: ${{ steps.tags.outputs.tags }} run: | - sudo apt-get update - sudo apt-get install -y jq doxygen graphviz plantuml - git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - + # 克隆文档仓库 git clone -b master https://$GH_PAT@github.com/FrozenLemonTee/original_docs.git deploy-repo - + for TAG in $TAGS; do echo "Processing tag: $TAG" - - # 检出特定标签 - git checkout $TAG - + + # 检出 tag + git checkout $TAG || { echo "Tag $TAG not found"; continue; } + # 提取版本号 VERSION=${TAG#v} - mkdir -p ../original_docs - doxygen Doxyfile - + + # 清理并创建文档目录 + mkdir -p ../original_docs/docs/html + doxygen Doxyfile > doxygen.log 2>&1 + + # 检查 HTML 是否生成 if [ ! -d "../original_docs/docs/html" ]; then - echo "Warning: Documentation was not generated for tag $TAG" + echo "Warning: Documentation not generated for $TAG" continue fi - + # 创建版本信息文件 echo '' > ../original_docs/docs/html/version.html - echo '' >> ../original_docs/docs/html/version.html - echo 'Version Info' >> ../original_docs/docs/html/version.html - echo '' >> ../original_docs/docs/html/version.html + echo 'Version Info' >> ../original_docs/docs/html/version.html + echo "

Documentation Version

" >> ../original_docs/docs/html/version.html echo "

Version: $VERSION

" >> ../original_docs/docs/html/version.html - echo '' >> ../original_docs/docs/html/version.html - + echo "

Tag: $TAG

" >> ../original_docs/docs/html/version.html + echo "

Build Date: $(date -u)

" >> ../original_docs/docs/html/version.html + echo "

Commit: $(git rev-parse $TAG)

" >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + # 部署到文档仓库 cd deploy-repo mkdir -p versions VERSION_DIR="versions/$VERSION" rm -rf "$VERSION_DIR" mkdir -p "$VERSION_DIR" - cp -r ../original_docs/docs/html/* "$VERSION_DIR"/ + cp -r ../../original_docs/docs/html/* "$VERSION_DIR"/ cd .. done - - # 提交更改 + + # 更新主 index.html 和 versions/index.html cd deploy-repo + + echo '' > index.html + echo '' >> index.html + echo '

Redirecting to stable documentation...

' >> index.html + echo '

Available versions:

Recent tag versions:

    ' >> index.html + for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r | head -5); do + echo "
  • Version $dir
  • " >> index.html + done + echo '
' >> index.html + + # versions/index.html + echo '' > versions/index.html + echo 'Versioned Documentation' >> versions/index.html + echo '

Versioned Documentation

Select a version:

    ' >> versions/index.html + for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r); do + echo "
  • Version $dir
  • " >> versions/index.html + done + echo '

Stable (master branch)

' >> versions/index.html + echo '

Latest (test branch)

' >> versions/index.html + + # 提交推送 git add . if git diff-index --quiet HEAD --; then echo "No changes to deploy" else - git commit -m "Deploy documentation for v0.1.0, v0.1.2, v0.1.4" + git commit -m "Deploy documentation for tags $TAGS" git push origin master + echo "✅ Documentation deployed successfully for tags $TAGS" fi From 9d8b7c3840cf9a3e564edcc9aba8b67236087b00 Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 20:05:38 +0800 Subject: [PATCH 08/13] docs: Fix path error --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index be3a078..7420221 100644 --- a/docs/index.md +++ b/docs/index.md @@ -30,7 +30,7 @@ Original是一个C++基础工具库,也是本人的第一个正式项目,用 ### 📋 历史版本 (Historical Versions) - **版本**: 按发布标签 -- [查看所有历史版本](../versions/) +- [查看所有历史版本](../versions/index.html) --- From be734f32cc47825e98950c5687e0e2a6e7ef8a39 Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 20:16:32 +0800 Subject: [PATCH 09/13] ci: Remove temporary branch push --- .github/workflows/deploy-docs-stable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docs-stable.yml b/.github/workflows/deploy-docs-stable.yml index de80ca9..0b41a78 100644 --- a/.github/workflows/deploy-docs-stable.yml +++ b/.github/workflows/deploy-docs-stable.yml @@ -4,7 +4,7 @@ name: Deploy Documentation - Stable on: push: - branches: [ master, test ] # Temporary add test branch to deploy list + branches: [ master ] jobs: build-and-deploy: From f61e8d295a247c8cd148b6d91e7aab56e8201240 Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 20:17:07 +0800 Subject: [PATCH 10/13] ci: Change branch push temporarily --- .github/workflows/deploy-docs-latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docs-latest.yml b/.github/workflows/deploy-docs-latest.yml index fbf347a..a25ed8a 100644 --- a/.github/workflows/deploy-docs-latest.yml +++ b/.github/workflows/deploy-docs-latest.yml @@ -4,7 +4,7 @@ name: Deploy Documentation - Latest on: push: - branches: [ test ] + branches: [ master ] # Temporary change from test to master to avoid concurrency push jobs: build-and-deploy: From 4f606cff412ed5c1590dee7aa6e5412d632f11fa Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 20:23:07 +0800 Subject: [PATCH 11/13] ci: Remove temporary workflow file --- .../workflows/deploy-docs-existing-tags.yml | 116 ------------------ 1 file changed, 116 deletions(-) delete mode 100644 .github/workflows/deploy-docs-existing-tags.yml diff --git a/.github/workflows/deploy-docs-existing-tags.yml b/.github/workflows/deploy-docs-existing-tags.yml deleted file mode 100644 index 2f942f5..0000000 --- a/.github/workflows/deploy-docs-existing-tags.yml +++ /dev/null @@ -1,116 +0,0 @@ -# .github/workflows/deploy-docs-existing-tags.yml -name: Deploy Documentation - Existing Tags - -on: - push: - branches: - - test # 监听 test 分支 push - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y doxygen graphviz plantuml jq - - - name: Set tags to deploy - id: tags - run: | - # 一次性部署的指定 tags - TAGS="v0.1.0 v0.1.2 v0.1.4" - echo "tags=$TAGS" >> $GITHUB_OUTPUT - echo "Deploying tags: $TAGS" - - - name: Build and deploy documentation - env: - GH_PAT: ${{ secrets.GH_PAT }} - TAGS: ${{ steps.tags.outputs.tags }} - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - # 克隆文档仓库 - git clone -b master https://$GH_PAT@github.com/FrozenLemonTee/original_docs.git deploy-repo - - for TAG in $TAGS; do - echo "Processing tag: $TAG" - - # 检出 tag - git checkout $TAG || { echo "Tag $TAG not found"; continue; } - - # 提取版本号 - VERSION=${TAG#v} - - # 清理并创建文档目录 - mkdir -p ../original_docs/docs/html - doxygen Doxyfile > doxygen.log 2>&1 - - # 检查 HTML 是否生成 - if [ ! -d "../original_docs/docs/html" ]; then - echo "Warning: Documentation not generated for $TAG" - continue - fi - - # 创建版本信息文件 - echo '' > ../original_docs/docs/html/version.html - echo 'Version Info' >> ../original_docs/docs/html/version.html - echo "

Documentation Version

" >> ../original_docs/docs/html/version.html - echo "

Version: $VERSION

" >> ../original_docs/docs/html/version.html - echo "

Tag: $TAG

" >> ../original_docs/docs/html/version.html - echo "

Build Date: $(date -u)

" >> ../original_docs/docs/html/version.html - echo "

Commit: $(git rev-parse $TAG)

" >> ../original_docs/docs/html/version.html - echo '' >> ../original_docs/docs/html/version.html - - # 部署到文档仓库 - cd deploy-repo - mkdir -p versions - VERSION_DIR="versions/$VERSION" - rm -rf "$VERSION_DIR" - mkdir -p "$VERSION_DIR" - cp -r ../../original_docs/docs/html/* "$VERSION_DIR"/ - cd .. - done - - # 更新主 index.html 和 versions/index.html - cd deploy-repo - - echo '' > index.html - echo '' >> index.html - echo '

Redirecting to stable documentation...

' >> index.html - echo '

Available versions:

Recent tag versions:

    ' >> index.html - for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r | head -5); do - echo "
  • Version $dir
  • " >> index.html - done - echo '
' >> index.html - - # versions/index.html - echo '' > versions/index.html - echo 'Versioned Documentation' >> versions/index.html - echo '

Versioned Documentation

Select a version:

    ' >> versions/index.html - for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r); do - echo "
  • Version $dir
  • " >> versions/index.html - done - echo '

Stable (master branch)

' >> versions/index.html - echo '

Latest (test branch)

' >> versions/index.html - - # 提交推送 - git add . - if git diff-index --quiet HEAD --; then - echo "No changes to deploy" - else - git commit -m "Deploy documentation for tags $TAGS" - git push origin master - echo "✅ Documentation deployed successfully for tags $TAGS" - fi From e5d2675515bab71b1903ddcd4fffb561bb874fcb Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 20:23:32 +0800 Subject: [PATCH 12/13] ci: Change branch to normal --- .github/workflows/deploy-docs-latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docs-latest.yml b/.github/workflows/deploy-docs-latest.yml index a25ed8a..fbf347a 100644 --- a/.github/workflows/deploy-docs-latest.yml +++ b/.github/workflows/deploy-docs-latest.yml @@ -4,7 +4,7 @@ name: Deploy Documentation - Latest on: push: - branches: [ master ] # Temporary change from test to master to avoid concurrency push + branches: [ test ] jobs: build-and-deploy: From 0028a921ea420f0c7ef90599ed6e25fab1438db2 Mon Sep 17 00:00:00 2001 From: frozenlemontee Date: Sat, 4 Oct 2025 20:38:08 +0800 Subject: [PATCH 13/13] ci: Set default build type to release --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bcdefab..0c8993b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set(ORIGINAL_VERSION 0.1.5) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED True) if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type (default Debug)" FORCE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (default Release)" FORCE) endif() include(CMakePackageConfigHelpers)