1- name : Release ( Export + Cover )
1+ name : Reusable Release Export (Pandoc in Docker )
22
33on :
4- release :
5- types : [published]
6- workflow_dispatch :
4+ workflow_call :
5+ inputs :
6+ summary_path :
7+ description : " Path to summary.md in the caller repository"
8+ required : true
9+ type : string
10+
11+ content_dir :
12+ description : " Working directory of the caller repository content"
13+ required : false
14+ type : string
15+ default : .
16+
17+ output_basename :
18+ description : " Base name for produced artifacts (without extension)"
19+ required : false
20+ type : string
21+ default : documentation
22+
23+ # Prebuilt image containing pandoc + xelatex + fonts
24+ pandoc_image :
25+ required : false
26+ type : string
27+ default : ghcr.io/<ORG>/pandoc-latex-fonts:3.9
28+
29+ # Knowledge Base PDF defaults
30+ papersize :
31+ required : false
32+ type : string
33+ default : a4
34+ margin :
35+ required : false
36+ type : string
37+ default : 2.5cm
38+ fontsize :
39+ required : false
40+ type : string
41+ default : 11pt
42+ mainfont :
43+ required : false
44+ type : string
45+ default : Noto Sans
46+ sansfont :
47+ required : false
48+ type : string
49+ default : Noto Sans
50+ monofont :
51+ required : false
52+ type : string
53+ default : Fira Code
754
855permissions :
9- contents : write
56+ contents : read
1057
1158jobs :
1259 export :
@@ -28,38 +75,60 @@ jobs:
2875 runs-on : ubuntu-latest
2976
3077 steps :
31- - name : Checkout repository (to access assets/cover.pdf)
78+ - name : Checkout caller repository
3279 uses : actions/checkout@v4
3380
34- - name : Download export artifacts
35- uses : actions/download-artifact @v4
81+ - name : Checkout shared repository (.github) for assemble script
82+ uses : actions/checkout @v4
3683 with :
37- name : release-export
38- path : exports
84+ repository : International-Data-Spaces-Association/.github
85+ path : _shared
3986
40- - name : Merge cover + body PDF (create additional artefact)
87+ - name : Assemble markdown from summary (shared script)
88+ working-directory : ${{ inputs.content_dir }}
4189 run : |
42- python -m pip install --upgrade pip
43- python -m pip install pypdf
44- python - <<'PY'
45- from pypdf import PdfWriter
90+ python3 ../_shared/scripts/assemble_from_summary.py \
91+ --summary "${{ inputs.summary_path }}" \
92+ --out "../combined.md" \
93+ --fail-on-missing
4694
47- cover = "assets/cover.pdf"
48- body = "exports/knowledge-base.pdf"
49- out = "exports/knowledge-base-with-cover.pdf"
95+ - name : Prepare output directory
96+ run : mkdir -p exports
5097
51- writer = PdfWriter()
52- writer.append(cover) # cover can be 1 or multiple pages
53- writer.append(body)
54- writer.write(out)
55- print(f"Created {out}")
56- PY
57- # pypdf supports merging by appending PDFs via PdfWriter.append() and writing the output. [2](https://bing.com/search?q=material+for+mkdocs+custom+404+page+setup)[3](https://squidfunk.github.io/mkdocs-material/customization/)
98+ - name : Build DOCX (Pandoc in Docker)
99+ uses : docker://${{ inputs.pandoc_image }}
100+ with :
101+ args : >-
102+ combined.md
103+ --from=gfm
104+ --standalone
105+ --resource-path=.:exports:exports/media:docs:docs/external:docs/assets
106+ --output=exports/${{ inputs.output_basename }}.docx
58107
59- - name : Upload release assets (keep ALL artefacts )
60- uses : softprops/action-gh-release@v2
108+ - name : Build PDF (Pandoc + XeLaTeX, KB defaults )
109+ uses : docker://${{ inputs.pandoc_image }}
61110 with :
62- files : |
63- exports/knowledge-base.pdf
64- exports/knowledge-base-with-cover.pdf
65- exports/knowledge-base.docx
111+ args : >-
112+ combined.md
113+ --from=gfm
114+ --standalone
115+ --toc
116+ --number-sections
117+ --pdf-engine=xelatex
118+ -V papersize=${{ inputs.papersize }}
119+ -V geometry:margin=${{ inputs.margin }}
120+ -V fontsize=${{ inputs.fontsize }}
121+ -V mainfont=${{ inputs.mainfont }}
122+ -V sansfont=${{ inputs.sansfont }}
123+ -V monofont=${{ inputs.monofont }}
124+ --resource-path=.:exports:exports/media:docs:docs/external:docs/assets
125+ --output=exports/${{ inputs.output_basename }}.pdf
126+
127+ - name : Upload export artifacts (PDF + DOCX)
128+ uses : actions/upload-artifact@v4
129+ with :
130+ name : release-export
131+ path : |
132+ exports/${{ inputs.output_basename }}.pdf
133+ exports/${{ inputs.output_basename }}.docx
134+ if-no-files-found : error
0 commit comments