Merge pull request #41 from xindoo/dev #70
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Generate PDF and EPUB | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'chapters/**' | |
| - 'original/**' | |
| - 'bilingual/**' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wget texlive-xetex texlive-fonts-recommended texlive-lang-chinese fonts-noto-cjk | |
| - name: Install Pandoc | |
| run: | | |
| wget https://github.com/jgm/pandoc/releases/download/3.2/pandoc-3.2-1-amd64.deb | |
| sudo dpkg -i pandoc-3.2-1-amd64.deb | |
| # Chinese version generation | |
| - name: Concatenate Markdown files (Chinese) | |
| run: | | |
| cd chapters | |
| cat > ../combined.md << 'EOF' | |
| --- | |
| title: "智能体设计模式" | |
| subtitle: "构建智能系统实战指南" | |
| author: "Antonio Gulli" | |
| translator: "xindoo" | |
| publisher: "GitHub: https://github.com/xindoo/agentic-design-patterns" | |
| documentclass: book | |
| lang: zh-CN | |
| CJKmainfont: "Noto Sans CJK SC" | |
| geometry: "margin=1in" | |
| --- | |
| EOF | |
| process_and_append() { | |
| local file="$1" | |
| local prefix="$2" | |
| sed -e 's|\.\./images/|images/|g' \ | |
| -e "s/^\[image\([0-9]*\)\]:/[${prefix}_image\1]:/" \ | |
| -e "s/!\[\]\[image\([0-9]*\)\]/![][${prefix}_image\1]/g" "$file" >> ../combined.md | |
| echo -e "\n\n" >> ../combined.md | |
| } | |
| process_and_append "Chapter 1_ Prompt Chaining.md" "ch1" | |
| process_and_append "Chapter 2_ Routing.md" "ch2" | |
| process_and_append "Chapter 3_ Parallelization.md" "ch3" | |
| process_and_append "Chapter 4_ Reflection.md" "ch4" | |
| process_and_append "Chapter 5_ Tool Use.md" "ch5" | |
| process_and_append "Chapter 6_ Planning.md" "ch6" | |
| process_and_append "Chapter 7_ Multi-Agent Collaboration.md" "ch7" | |
| process_and_append "Chapter 8_ Memory Management.md" "ch8" | |
| process_and_append "Chapter 9_ Learning and Adaptation.md" "ch9" | |
| process_and_append "Chapter 10_ Model Context Protocol (MCP).md" "ch10" | |
| process_and_append "Chapter 11_ Goal Setting and Monitoring.md" "ch11" | |
| process_and_append "Chapter 12_ Exception Handling and Recovery.md" "ch12" | |
| process_and_append "Chapter 13_ Human-in-the-Loop.md" "ch13" | |
| process_and_append "Chapter 14_ Knowledge Retrieval (RAG).md" "ch14" | |
| process_and_append "Chapter 15_ Inter-Agent Communication (A2A).md" "ch15" | |
| process_and_append "Chapter 16_ Resource-Aware Optimization.md" "ch16" | |
| process_and_append "Chapter 17_ Reasoning Techniques.md" "ch17" | |
| process_and_append "Chapter 18_ Guardrails_Safety Patterns.md" "ch18" | |
| process_and_append "Chapter 19_ Evaluation and Monitoring.md" "ch19" | |
| process_and_append "Chapter 20_ Prioritization.md" "ch20" | |
| process_and_append "Chapter 21_ Exploration and Discovery.md" "ch21" | |
| process_and_append "Appendix A_ Advanced Prompting Techniques.md" "appa" | |
| process_and_append "Appendix B - AI Agentic Interactions_ From GUI to Real world environment.md" "appb" | |
| process_and_append "Appendix C - Quick overview of Agentic Frameworks.md" "appc" | |
| process_and_append "Appendix D - Building an Agent with AgentSpace (on-line only).md" "appd" | |
| process_and_append "Appendix E - AI Agents on the CLI.md" "appe" | |
| process_and_append "Appendix F - Under the Hood_ An Inside Look at the Agents' Reasoning Engines.md" "appf" | |
| process_and_append "Appendix G - Coding agents.md" "appg" | |
| process_and_append "Conclusion.md" "conclusion" | |
| process_and_append "Glossary.md" "glossary" | |
| process_and_append "Index of Terms.md" "index" | |
| process_and_append "Frequently Asked Questions_ Agentic Design Patterns.md" "faq" | |
| - name: Generate PDF (Chinese) | |
| run: | | |
| pandoc combined.md \ | |
| -o agentic-design-patterns-chinese.pdf \ | |
| --pdf-engine=xelatex \ | |
| --toc \ | |
| --toc-depth=2 \ | |
| -V mainfont="Noto Sans CJK SC" \ | |
| -V geometry:margin=1in \ | |
| -V hyperrefoptions:linktoc=all \ | |
| --listings \ | |
| -H .github/scripts/pandoc-listings.tex \ | |
| --metadata title="智能体设计模式" \ | |
| --metadata author="Antonio Gulli" \ | |
| --metadata translator="xindoo" \ | |
| --metadata publisher="GitHub: https://github.com/xindoo/agentic-design-patterns" \ | |
| --metadata lang=zh-CN | |
| - name: Generate EPUB (Chinese) | |
| run: | | |
| pandoc combined.md \ | |
| -o agentic-design-patterns-chinese.epub \ | |
| --toc \ | |
| --toc-depth=2 \ | |
| --split-level=1 \ | |
| --metadata title="智能体设计模式" \ | |
| --metadata author="Antonio Gulli" \ | |
| --metadata translator="xindoo" \ | |
| --metadata publisher="GitHub: https://github.com/xindoo/agentic-design-patterns" \ | |
| --metadata lang=zh-CN \ | |
| --epub-cover-image=images/cover.png | |
| - name: Upload PDF artifact (Chinese) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agentic-design-patterns-chinese-pdf | |
| path: agentic-design-patterns-chinese.pdf | |
| - name: Upload EPUB artifact (Chinese) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agentic-design-patterns-chinese-epub | |
| path: agentic-design-patterns-chinese.epub | |
| # English version generation | |
| - name: Concatenate Markdown files (English) | |
| run: | | |
| cd original | |
| cat > ../combined-en.md << 'EOF' | |
| --- | |
| title: "Agentic Design Patterns" | |
| subtitle: "A Practical Guide to Building Intelligent Systems" | |
| author: "Antonio Gulli" | |
| publisher: "GitHub: https://github.com/xindoo/agentic-design-patterns" | |
| documentclass: book | |
| lang: en-US | |
| geometry: "margin=1in" | |
| --- | |
| EOF | |
| process_and_append() { | |
| local file="$1" | |
| local prefix="$2" | |
| sed -e 's|\.\./images/|images/|g' \ | |
| -e "s/^\[image\([0-9]*\)\]:/[${prefix}_image\1]:/" \ | |
| -e "s/!\[\]\[image\([0-9]*\)\]/![][${prefix}_image\1]/g" "$file" >> ../combined-en.md | |
| echo -e "\n\n" >> ../combined-en.md | |
| } | |
| process_and_append "Chapter 1_ Prompt Chaining.md" "en_ch1" | |
| process_and_append "Chapter 2_ Routing.md" "en_ch2" | |
| process_and_append "Chapter 3_ Parallelization.md" "en_ch3" | |
| process_and_append "Chapter 4_ Reflection.md" "en_ch4" | |
| process_and_append "Chapter 5_ Tool Use.md" "en_ch5" | |
| process_and_append "Chapter 6_ Planning.md" "en_ch6" | |
| process_and_append "Chapter 7_ Multi-Agent Collaboration.md" "en_ch7" | |
| process_and_append "Chapter 8_ Memory Management.md" "en_ch8" | |
| process_and_append "Chapter 9_ Learning and Adaptation.md" "en_ch9" | |
| process_and_append "Chapter 10_ Model Context Protocol (MCP).md" "en_ch10" | |
| process_and_append "Chapter 11_ Goal Setting and Monitoring.md" "en_ch11" | |
| process_and_append "Chapter 12_ Exception Handling and Recovery.md" "en_ch12" | |
| process_and_append "Chapter 13_ Human-in-the-Loop.md" "en_ch13" | |
| process_and_append "Chapter 14_ Knowledge Retrieval (RAG).md" "en_ch14" | |
| process_and_append "Chapter 15_ Inter-Agent Communication (A2A).md" "en_ch15" | |
| process_and_append "Chapter 16_ Resource-Aware Optimization.md" "en_ch16" | |
| process_and_append "Chapter 17_ Reasoning Techniques.md" "en_ch17" | |
| process_and_append "Chapter 18_ Guardrails_Safety Patterns.md" "en_ch18" | |
| process_and_append "Chapter 19_ Evaluation and Monitoring.md" "en_ch19" | |
| process_and_append "Chapter 20_ Prioritization.md" "en_ch20" | |
| process_and_append "Chapter 21_ Exploration and Discovery.md" "en_ch21" | |
| process_and_append "Appendix A_ Advanced Prompting Techniques.md" "en_appa" | |
| process_and_append "Appendix B - AI Agentic Interactions_ From GUI to Real world environment.md" "en_appb" | |
| process_and_append "Appendix C - Quick overview of Agentic Frameworks.md" "en_appc" | |
| process_and_append "Appendix D - Building an Agent with AgentSpace (on-line only).md" "en_appd" | |
| process_and_append "Appendix E - AI Agents on the CLI.md" "en_appe" | |
| process_and_append "Appendix F - Under the Hood_ An Inside Look at the Agents' Reasoning Engines.md" "en_appf" | |
| process_and_append "Appendix G - Coding agents.md" "en_appg" | |
| process_and_append "Conclusion.md" "en_conclusion" | |
| process_and_append "Glossary.md" "en_glossary" | |
| process_and_append "Index of Terms.md" "en_index" | |
| process_and_append "Online contribution - Frequently Asked Questions_ Agentic Design Patterns.md" "en_faq" | |
| - name: Generate PDF (English) | |
| run: | | |
| pandoc combined-en.md \ | |
| -o agentic-design-patterns-en.pdf \ | |
| --pdf-engine=xelatex \ | |
| --toc \ | |
| --toc-depth=2 \ | |
| -V mainfont="DejaVu Serif" \ | |
| -V geometry:margin=1in \ | |
| -V hyperrefoptions:linktoc=all \ | |
| --listings \ | |
| -H .github/scripts/pandoc-listings.tex \ | |
| --metadata title="Agentic Design Patterns" \ | |
| --metadata author="Antonio Gulli" \ | |
| --metadata publisher="GitHub: https://github.com/xindoo/agentic-design-patterns" \ | |
| --metadata lang=en-US | |
| - name: Generate EPUB (English) | |
| run: | | |
| pandoc combined-en.md \ | |
| -o agentic-design-patterns-en.epub \ | |
| --toc \ | |
| --toc-depth=2 \ | |
| --split-level=1 \ | |
| --metadata title="Agentic Design Patterns" \ | |
| --metadata author="Antonio Gulli" \ | |
| --metadata publisher="GitHub: https://github.com/xindoo/agentic-design-patterns" \ | |
| --metadata lang=en-US \ | |
| --epub-cover-image=images/cover.png | |
| - name: Upload PDF artifact (English) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agentic-design-patterns-en-pdf | |
| path: agentic-design-patterns-en.pdf | |
| - name: Upload EPUB artifact (English) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agentic-design-patterns-en-epub | |
| path: agentic-design-patterns-en.epub | |
| # Bilingual version generation | |
| - name: Concatenate Markdown files (Bilingual) | |
| run: | | |
| cd bilingual | |
| cat > ../combined-bilingual.md << 'EOF' | |
| --- | |
| title: "智能体设计模式 (双语版)" | |
| subtitle: "Agentic Design Patterns (Bilingual Edition)" | |
| author: "Antonio Gulli" | |
| translator: "xindoo" | |
| publisher: "GitHub: https://github.com/xindoo/agentic-design-patterns" | |
| documentclass: book | |
| lang: zh-CN | |
| CJKmainfont: "Noto Sans CJK SC" | |
| geometry: "margin=1in" | |
| --- | |
| EOF | |
| process_and_append() { | |
| local file="$1" | |
| local prefix="$2" | |
| sed -e 's|\.\./images/|images/|g' \ | |
| -e "s/^\[image\([0-9]*\)\]:/[${prefix}_image\1]:/" \ | |
| -e "s/!\[\]\[image\([0-9]*\)\]/![][${prefix}_image\1]/g" "$file" >> ../combined-bilingual.md | |
| echo -e "\n\n" >> ../combined-bilingual.md | |
| } | |
| process_and_append "Chapter 1_ Prompt Chaining.md" "bi_ch1" | |
| process_and_append "Chapter 2_ Routing.md" "bi_ch2" | |
| process_and_append "Chapter 3_ Parallelization.md" "bi_ch3" | |
| process_and_append "Chapter 4_ Reflection.md" "bi_ch4" | |
| process_and_append "Chapter 5_ Tool Use.md" "bi_ch5" | |
| process_and_append "Chapter 6_ Planning.md" "bi_ch6" | |
| process_and_append "Chapter 7_ Multi-Agent Collaboration.md" "bi_ch7" | |
| process_and_append "Chapter 8_ Memory Management.md" "bi_ch8" | |
| process_and_append "Chapter 9_ Learning and Adaptation.md" "bi_ch9" | |
| process_and_append "Chapter 10_ Model Context Protocol (MCP).md" "bi_ch10" | |
| process_and_append "Chapter 11_ Goal Setting and Monitoring.md" "bi_ch11" | |
| process_and_append "Chapter 12_ Exception Handling and Recovery.md" "bi_ch12" | |
| process_and_append "Chapter 13_ Human-in-the-Loop.md" "bi_ch13" | |
| process_and_append "Chapter 14_ Knowledge Retrieval (RAG).md" "bi_ch14" | |
| process_and_append "Chapter 15_ Inter-Agent Communication (A2A).md" "bi_ch15" | |
| process_and_append "Chapter 16_ Resource-Aware Optimization.md" "bi_ch16" | |
| process_and_append "Chapter 17_ Reasoning Techniques.md" "bi_ch17" | |
| process_and_append "Chapter 18_ Guardrails_Safety Patterns.md" "bi_ch18" | |
| process_and_append "Chapter 19_ Evaluation and Monitoring.md" "bi_ch19" | |
| process_and_append "Chapter 20_ Prioritization.md" "bi_ch20" | |
| process_and_append "Chapter 21_ Exploration and Discovery.md" "bi_ch21" | |
| process_and_append "Appendix A_ Advanced Prompting Techniques.md" "bi_appa" | |
| process_and_append "Appendix B - AI Agentic Interactions_ From GUI to Real world environment.md" "bi_appb" | |
| process_and_append "Appendix C - Quick overview of Agentic Frameworks.md" "bi_appc" | |
| process_and_append "Appendix D - Building an Agent with AgentSpace (on-line only).md" "bi_appd" | |
| process_and_append "Appendix E - AI Agents on the CLI.md" "bi_appe" | |
| process_and_append "Appendix F - Under the Hood_ An Inside Look at the Agents' Reasoning Engines.md" "bi_appf" | |
| process_and_append "Appendix G - Coding agents.md" "bi_appg" | |
| process_and_append "Conclusion.md" "bi_conclusion" | |
| process_and_append "Glossary.md" "bi_glossary" | |
| process_and_append "Index of Terms.md" "bi_index" | |
| process_and_append "Frequently Asked Questions_ Agentic Design Patterns.md" "bi_faq" | |
| process_and_append "Glossary.md" "bi_glossary" | |
| process_and_append "Index of Terms.md" "bi_index" | |
| process_and_append "Frequently Asked Questions_ Agentic Design Patterns.md" "bi_faq" | |
| - name: Generate PDF (Bilingual) | |
| run: | | |
| pandoc combined-bilingual.md \ | |
| -o agentic-design-patterns-bilingual.pdf \ | |
| --pdf-engine=xelatex \ | |
| --toc \ | |
| --toc-depth=2 \ | |
| -V mainfont="Noto Sans CJK SC" \ | |
| -V geometry:margin=1in \ | |
| -V hyperrefoptions:linktoc=all \ | |
| --listings \ | |
| -H .github/scripts/pandoc-listings.tex \ | |
| --metadata title="智能体设计模式 (双语版)" \ | |
| --metadata author="Antonio Gulli" \ | |
| --metadata translator="xindoo" \ | |
| --metadata publisher="GitHub: https://github.com/xindoo/agentic-design-patterns" \ | |
| --metadata lang=zh-CN | |
| - name: Generate EPUB (Bilingual) | |
| run: | | |
| pandoc combined-bilingual.md \ | |
| -o agentic-design-patterns-bilingual.epub \ | |
| --toc \ | |
| --toc-depth=2 \ | |
| --split-level=1 \ | |
| --metadata title="智能体设计模式 (双语版)" \ | |
| --metadata author="Antonio Gulli" \ | |
| --metadata translator="xindoo" \ | |
| --metadata publisher="GitHub: https://github.com/xindoo/agentic-design-patterns" \ | |
| --metadata lang=zh-CN \ | |
| --epub-cover-image=images/cover.png | |
| - name: Upload PDF artifact (Bilingual) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agentic-design-patterns-bilingual-pdf | |
| path: agentic-design-patterns-bilingual.pdf | |
| - name: Upload EPUB artifact (Bilingual) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agentic-design-patterns-bilingual-epub | |
| path: agentic-design-patterns-bilingual.epub | |
| - name: Create Release | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ github.run_number }} | |
| name: Release v${{ github.run_number }} | |
| files: | | |
| agentic-design-patterns-chinese.pdf | |
| agentic-design-patterns-chinese.epub | |
| agentic-design-patterns-en.pdf | |
| agentic-design-patterns-en.epub | |
| agentic-design-patterns-bilingual.pdf | |
| agentic-design-patterns-bilingual.epub | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |