diff --git a/.github/scripts/md2pdf.py b/.github/scripts/md2pdf.py new file mode 100644 index 0000000..8b16510 --- /dev/null +++ b/.github/scripts/md2pdf.py @@ -0,0 +1,14 @@ +# +# md2pdf.py +# +# Carl Zeiss GOM Metrology GmbH, 2024 +# +# --- +'''Convert Markdown document to PDF''' +import sys +from markdown_pdf import MarkdownPdf, Section + +pdf = MarkdownPdf(toc_level=4) +pdf.add_section(Section(open(sys.argv[1], encoding='utf-8').read(), toc=False), user_css="body {font-family: sans-serif;}") +pdf.meta["title"] = "Releasenotes" +pdf.save(sys.argv[2]) diff --git a/.github/workflows/releasenotes_pdf.yml b/.github/workflows/releasenotes_pdf.yml index 55632ea..cf26dff 100644 --- a/.github/workflows/releasenotes_pdf.yml +++ b/.github/workflows/releasenotes_pdf.yml @@ -14,13 +14,15 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Install Pandoc + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install markdown_pdf run: | - sudo apt-get update - # Install pdflatex as prerequisite for pandoc PDF output - sudo apt-get install -y texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra - sudo apt-get install -y pandoc - + pip install markdown_pdf + - name: Find and Convert Release Notes id: convert_notes run: | @@ -29,11 +31,11 @@ jobs: basepath=$(dirname "{}") # Get the folder path echo $basepath if [ ! -f "$basepath/Releasenotes.pdf" ]; then - pandoc --variable mainfont="Arial" "{}" -o "$basepath/Releasenotes.pdf" + python .github/scripts/md2pdf.py "{}" "$basepath/Releasenotes.pdf" git config --global user.name "GitHub Action" git config --global user.email "action@github.com" git add "$basepath/Releasenotes.pdf" git commit -m "Add Releasenotes.pdf" - git push origin main + git push origin ${GITHUB_REF#refs/*/} fi ' \; diff --git a/AppExamples/dialog_widgets/DropdownWidget/doc/Releasenotes.pdf b/AppExamples/dialog_widgets/DropdownWidget/doc/Releasenotes.pdf index 5c8ded0..6144066 100644 Binary files a/AppExamples/dialog_widgets/DropdownWidget/doc/Releasenotes.pdf and b/AppExamples/dialog_widgets/DropdownWidget/doc/Releasenotes.pdf differ diff --git a/AppExamples/script_resources/ResourceAccess/doc/Releasenotes.pdf b/AppExamples/script_resources/ResourceAccess/doc/Releasenotes.pdf index 735d7bf..0ff9ff6 100644 Binary files a/AppExamples/script_resources/ResourceAccess/doc/Releasenotes.pdf and b/AppExamples/script_resources/ResourceAccess/doc/Releasenotes.pdf differ diff --git a/AppExamples/scripted_actuals/ScriptedActualVolumeDefects/doc/Releasenotes.pdf b/AppExamples/scripted_actuals/ScriptedActualVolumeDefects/doc/Releasenotes.pdf index 5286f50..ac9ffe6 100644 Binary files a/AppExamples/scripted_actuals/ScriptedActualVolumeDefects/doc/Releasenotes.pdf and b/AppExamples/scripted_actuals/ScriptedActualVolumeDefects/doc/Releasenotes.pdf differ diff --git a/AppExamples/scripted_checks/ScriptedScalarCheck/doc/Releasenotes.pdf b/AppExamples/scripted_checks/ScriptedScalarCheck/doc/Releasenotes.pdf index b8f2667..96e3347 100644 Binary files a/AppExamples/scripted_checks/ScriptedScalarCheck/doc/Releasenotes.pdf and b/AppExamples/scripted_checks/ScriptedScalarCheck/doc/Releasenotes.pdf differ diff --git a/AppExamples/scripted_diagrams/ScriptedDiagramBasics/doc/Releasenotes.pdf b/AppExamples/scripted_diagrams/ScriptedDiagramBasics/doc/Releasenotes.pdf index 2e1e40b..7dad089 100644 Binary files a/AppExamples/scripted_diagrams/ScriptedDiagramBasics/doc/Releasenotes.pdf and b/AppExamples/scripted_diagrams/ScriptedDiagramBasics/doc/Releasenotes.pdf differ