Merge pull request #2 from J0bot/chantier/workflow-pdf
Chantier/workflow pdf
This commit is contained in:
37
.github/workflows/generate-pdf.yml
vendored
37
.github/workflows/generate-pdf.yml
vendored
@@ -20,16 +20,14 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install fonts and git
|
- name: Install fonts
|
||||||
run: apk add --no-cache font-dejavu git
|
run: apk add --no-cache font-dejavu
|
||||||
|
|
||||||
- name: Prepare markdown (strip manual TOC)
|
- name: Prepare markdown (strip manual TOC)
|
||||||
run: |
|
run: |
|
||||||
cd paper
|
|
||||||
# Remove the manual TOC table between "## Table des matières" and the next "---"
|
|
||||||
python3 -c "
|
python3 -c "
|
||||||
import re
|
import re
|
||||||
with open('README.md', 'r', encoding='utf-8') as f:
|
with open('paper/README.md', 'r', encoding='utf-8') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
content = re.sub(
|
content = re.sub(
|
||||||
r'## Table des matières\n+\|.*?\n\n---',
|
r'## Table des matières\n+\|.*?\n\n---',
|
||||||
@@ -37,7 +35,7 @@ jobs:
|
|||||||
content,
|
content,
|
||||||
flags=re.DOTALL
|
flags=re.DOTALL
|
||||||
)
|
)
|
||||||
with open('paper_clean.md', 'w', encoding='utf-8') as f:
|
with open('paper/paper_clean.md', 'w', encoding='utf-8') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
"
|
"
|
||||||
|
|
||||||
@@ -63,17 +61,32 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate PDF
|
- name: Generate PDF
|
||||||
run: |
|
run: |
|
||||||
cd paper
|
pandoc paper/metadata.yaml paper/paper_clean.md \
|
||||||
pandoc metadata.yaml paper_clean.md \
|
-o paper/xerboxion_paper.pdf \
|
||||||
-o xerboxion_paper.pdf \
|
|
||||||
--pdf-engine=xelatex \
|
--pdf-engine=xelatex \
|
||||||
--toc \
|
--toc \
|
||||||
--toc-depth=3 \
|
--toc-depth=3 \
|
||||||
--syntax-highlighting=tango
|
--syntax-highlighting=tango
|
||||||
|
|
||||||
- name: Cleanup temp files
|
- name: Upload PDF artifact
|
||||||
run: |
|
uses: actions/upload-artifact@v4
|
||||||
rm -f paper/paper_clean.md paper/metadata.yaml
|
with:
|
||||||
|
name: xerboxion_paper
|
||||||
|
path: paper/xerboxion_paper.pdf
|
||||||
|
|
||||||
|
commit-pdf:
|
||||||
|
needs: generate-pdf
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download PDF artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: xerboxion_paper
|
||||||
|
path: paper/
|
||||||
|
|
||||||
- name: Commit PDF
|
- name: Commit PDF
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
BIN
paper/xerboxion_paper.pdf
Normal file
BIN
paper/xerboxion_paper.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user