-
Notifications
You must be signed in to change notification settings - Fork 907
363 lines (333 loc) · 16 KB
/
Copy pathgenerate-pdf.yml
File metadata and controls
363 lines (333 loc) · 16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
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 }}