File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build Markdown Ebook
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 : Create output directory
27+ run : mkdir -p _ebook
28+
29+ - name : Convert notebooks to Markdown
30+ run : |
31+ for chapter in ch1 ch2 ch3 ch4; do
32+ if [ -d "$chapter" ]; then
33+ mkdir -p "_ebook/$chapter"
34+ for notebook in "$chapter"/*.ipynb; do
35+ if [ -f "$notebook" ]; then
36+ jupyter nbconvert --to markdown --output-dir="_ebook/$chapter" "$notebook"
37+ fi
38+ done
39+ fi
40+ done
41+
42+ - name : Copy assets
43+ run : |
44+ # Copy image folders that may be referenced by markdown
45+ cp -r ch3/milvus_image_search_data _ebook/ch3/ 2>/dev/null || true
46+ cp -r ch3/docs _ebook/ch3/ 2>/dev/null || true
47+ cp -r ch4/images _ebook/ch4/ 2>/dev/null || true
48+ cp -r ch4/tutorial-yaml _ebook/ch4/ 2>/dev/null || true
49+ cp README.md README-zh.md _ebook/ 2>/dev/null || true
50+
51+ - name : Deploy to ebook branch
52+ uses : peaceiris/actions-gh-pages@v4
53+ with :
54+ github_token : ${{ secrets.GITHUB_TOKEN }}
55+ publish_dir : ./_ebook
56+ publish_branch : ebook
You can’t perform that action at this time.
0 commit comments