|
| 1 | +name: Build and Deploy Runbook |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-and-deploy: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Set up Python |
| 18 | + uses: actions/setup-python@v5 |
| 19 | + with: |
| 20 | + python-version: '3.11' |
| 21 | + |
| 22 | + - name: Install dependencies |
| 23 | + run: | |
| 24 | + pip install nbconvert jupyter |
| 25 | + |
| 26 | + - name: Convert notebooks to HTML |
| 27 | + run: | |
| 28 | + mkdir -p _site |
| 29 | + for chapter in ch1 ch2 ch3 ch4; do |
| 30 | + if [ -d "$chapter" ]; then |
| 31 | + mkdir -p "_site/$chapter" |
| 32 | + for notebook in "$chapter"/*.ipynb; do |
| 33 | + if [ -f "$notebook" ]; then |
| 34 | + jupyter nbconvert --to html --template lab "$notebook" --output-dir "_site/$chapter" |
| 35 | + fi |
| 36 | + done |
| 37 | + fi |
| 38 | + done |
| 39 | + |
| 40 | + - name: Copy images and assets |
| 41 | + run: | |
| 42 | + cp -r ch3/milvus_image_search_data _site/ch3/ 2>/dev/null || true |
| 43 | + cp -r ch4/images _site/ch4/ 2>/dev/null || true |
| 44 | + cp -r ch4/tutorial-yaml _site/ch4/ 2>/dev/null || true |
| 45 | + cp scripts/custom.css _site/custom.css |
| 46 | + |
| 47 | + - name: Inject custom CSS into HTML files |
| 48 | + run: | |
| 49 | + for html in $(find _site -name "*.html" -not -name "index.html"); do |
| 50 | + depth=$(echo "$html" | tr -cd '/' | wc -c) |
| 51 | + prefix="" |
| 52 | + for ((i=2; i<depth; i++)); do prefix="../$prefix"; done |
| 53 | + sed -i "s|</head>|<link rel=\"stylesheet\" href=\"${prefix}custom.css\"></head>|" "$html" |
| 54 | + done |
| 55 | + |
| 56 | + - name: Generate index page |
| 57 | + run: | |
| 58 | + cat > _site/index.html << 'EOF' |
| 59 | + <!DOCTYPE html> |
| 60 | + <html lang="zh"> |
| 61 | + <head> |
| 62 | + <meta charset="UTF-8"> |
| 63 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 64 | + <title>Milvus Workshop</title> |
| 65 | + <style> |
| 66 | + :root { --text: #1d1d1f; --text-secondary: #86868b; --bg: #fff; --bg-secondary: #f5f5f7; --accent: #0071e3; --border: #d2d2d7; } |
| 67 | + * { margin: 0; padding: 0; box-sizing: border-box; } |
| 68 | + body { font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; } |
| 69 | + .container { max-width: 980px; margin: 0 auto; padding: 0 22px; } |
| 70 | + header { text-align: center; padding: 80px 22px 60px; } |
| 71 | + header img { width: 64px; margin-bottom: 24px; } |
| 72 | + header h1 { font-size: 56px; font-weight: 700; letter-spacing: -0.005em; line-height: 1.07; margin-bottom: 12px; } |
| 73 | + header p { font-size: 21px; color: var(--text-secondary); font-weight: 400; } |
| 74 | + .chapters { padding-bottom: 80px; } |
| 75 | + .chapter { margin-bottom: 48px; } |
| 76 | + .chapter h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); } |
| 77 | + .lessons { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: 12px; overflow: hidden; } |
| 78 | + .lesson { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; background: var(--bg); text-decoration: none; color: var(--text); transition: background 0.2s; } |
| 79 | + .lesson:hover { background: var(--bg-secondary); } |
| 80 | + .lesson-title { font-size: 17px; font-weight: 400; } |
| 81 | + .lang-tag { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 12px; } |
| 82 | + .lang-zh { background: #fef3e2; color: #b25000; } |
| 83 | + .lang-en { background: #e8f4fd; color: #0066cc; } |
| 84 | + .arrow { color: var(--text-secondary); font-size: 20px; margin-left: 12px; } |
| 85 | + footer { text-align: center; padding: 40px 22px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 14px; } |
| 86 | + footer a { color: var(--accent); text-decoration: none; } |
| 87 | + @media (max-width: 734px) { |
| 88 | + header h1 { font-size: 32px; } |
| 89 | + header p { font-size: 17px; } |
| 90 | + .chapter h2 { font-size: 22px; } |
| 91 | + } |
| 92 | + </style> |
| 93 | + </head> |
| 94 | + <body> |
| 95 | + <header> |
| 96 | + <img src="ch4/images/milvus-logo.svg" alt="Milvus" onerror="this.style.display='none'"> |
| 97 | + <h1>Milvus Workshop</h1> |
| 98 | + <p>从入门到应用的向量数据库完整教程</p> |
| 99 | + </header> |
| 100 | + <div class="container"> |
| 101 | + <div class="chapters"> |
| 102 | + <div class="chapter"> |
| 103 | + <h2>Part 1 · 探索 Milvus</h2> |
| 104 | + <div class="lessons"> |
| 105 | + <a href="ch1/ch1_1.html" class="lesson"><span class="lesson-title">1.1 Milvus 向量数据库概述</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 106 | + <a href="ch1/ch1_1_en.html" class="lesson"><span class="lesson-title">1.1 Overview of Milvus Vector Database</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 107 | + <a href="ch1/ch1_2.html" class="lesson"><span class="lesson-title">1.2 Milvus 安装实践</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 108 | + <a href="ch1/ch1_2_en.html" class="lesson"><span class="lesson-title">1.2 Hands-on Milvus Installation</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 109 | + <a href="ch1/ch1_3.html" class="lesson"><span class="lesson-title">1.3 Milvus 核心架构与组件解析</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 110 | + <a href="ch1/ch1_3_en.html" class="lesson"><span class="lesson-title">1.3 Analysis of Milvus Core Architecture</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 111 | + </div> |
| 112 | + </div> |
| 113 | + <div class="chapter"> |
| 114 | + <h2>Part 2 · 基础操作</h2> |
| 115 | + <div class="lessons"> |
| 116 | + <a href="ch2/ch2_1.html" class="lesson"><span class="lesson-title">2.1 连接 Milvus 与 Collection 管理</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 117 | + <a href="ch2/ch2_1_en.html" class="lesson"><span class="lesson-title">2.1 Connecting to Milvus and Managing Collections</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 118 | + <a href="ch2/ch2_2.html" class="lesson"><span class="lesson-title">2.2 数据插入与管理</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 119 | + <a href="ch2/ch2_2_en.html" class="lesson"><span class="lesson-title">2.2 Data Insertion and Management</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 120 | + <a href="ch2/ch2_3.html" class="lesson"><span class="lesson-title">2.3 索引构建与管理</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 121 | + <a href="ch2/ch2_3_en.html" class="lesson"><span class="lesson-title">2.3 Building and Managing Indexes</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 122 | + <a href="ch2/ch2_4.html" class="lesson"><span class="lesson-title">2.4 向量搜索、查询与混合搜索</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 123 | + <a href="ch2/ch2_4_en.html" class="lesson"><span class="lesson-title">2.4 Vector Similarity Search, Query, and Hybrid Search</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 124 | + </div> |
| 125 | + </div> |
| 126 | + <div class="chapter"> |
| 127 | + <h2>Part 3 · 应用实践</h2> |
| 128 | + <div class="lessons"> |
| 129 | + <a href="ch3/ch3_1.html" class="lesson"><span class="lesson-title">3.1 Milvus 在图像搜索中的应用</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 130 | + <a href="ch3/ch3_1_en.html" class="lesson"><span class="lesson-title">3.1 Applying Milvus in Image Search</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 131 | + <a href="ch3/ch3_2.html" class="lesson"><span class="lesson-title">3.2 Milvus 在 RAG 中的应用</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 132 | + <a href="ch3/ch3_2_en.html" class="lesson"><span class="lesson-title">3.2 Applying Milvus in RAG</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 133 | + <a href="ch3/ch3_3.html" class="lesson"><span class="lesson-title">3.3 Milvus 在 AI Agent 中的应用</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 134 | + <a href="ch3/ch3_3_en.html" class="lesson"><span class="lesson-title">3.3 Applying Milvus in AI Agents</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 135 | + <a href="ch3/ch3_4.html" class="lesson"><span class="lesson-title">3.4 Milvus 生态功能概览</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 136 | + <a href="ch3/ch3_4_en.html" class="lesson"><span class="lesson-title">3.4 Overview of Milvus Ecosystem Features</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 137 | + </div> |
| 138 | + </div> |
| 139 | + <div class="chapter"> |
| 140 | + <h2>Part 4 · 进阶实践</h2> |
| 141 | + <div class="lessons"> |
| 142 | + <a href="ch4/ch4_1.html" class="lesson"><span class="lesson-title">4.1 Milvus 可观测性与运维实践</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 143 | + <a href="ch4/ch4_1_en.html" class="lesson"><span class="lesson-title">4.1 Hands-on Milvus Observability and Operations</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 144 | + <a href="ch4/ch4_2.html" class="lesson"><span class="lesson-title">4.2 VectorDBBench 性能测试实践</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 145 | + <a href="ch4/ch4_2_en.html" class="lesson"><span class="lesson-title">4.2 Hands-on Benchmarking with VectorDBBench</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 146 | + <a href="ch4/ch4_3.html" class="lesson"><span class="lesson-title">4.3 Milvus 性能调优</span><span><span class="lang-tag lang-zh">中文</span><span class="arrow">›</span></span></a> |
| 147 | + <a href="ch4/ch4_3_en.html" class="lesson"><span class="lesson-title">4.3 Milvus Performance Tuning</span><span><span class="lang-tag lang-en">EN</span><span class="arrow">›</span></span></a> |
| 148 | + </div> |
| 149 | + </div> |
| 150 | + </div> |
| 151 | + </div> |
| 152 | + <footer>Built with <a href="https://milvus.io" target="_blank">Milvus</a></footer> |
| 153 | + </body> |
| 154 | + </html> |
| 155 | + EOF |
| 156 | + |
| 157 | + - name: Deploy to gh-pages branch |
| 158 | + uses: peaceiris/actions-gh-pages@v4 |
| 159 | + with: |
| 160 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 161 | + publish_dir: ./_site |
| 162 | + publish_branch: gh-pages |
0 commit comments