This file contains 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: Convert Markdown with Mermaid to PDF | |
on: | |
push: | |
paths: | |
- '**/*.md' | |
workflow_dispatch: | |
jobs: | |
convert_md_to_pdf: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install pandoc and dependencies | |
run: | | |
sudo apt-get install -y pandoc texlive-xetex | |
sudo pip install pandoc-mermaid-filter | |
echo "Installed packages:" | |
pip list | |
- name: Debug PATH | |
run: | | |
pip list | |
echo "Current PATH:" | |
echo $PATH | |
echo "Checking pandoc-mermaid-filter installation location:" | |
find $(python -m site --user-base) -name pandoc-mermaid-filter | |
- name: Convert Markdown to PDF | |
run: | | |
export PATH="$PATH:$(python -m site --user-base)/bin" | |
for file in $(find . -name '*.md'); do | |
pdf_file="${file%.md}.pdf" | |
pandoc --filter=pandoc-mermaid-filter "$file" -o "$pdf_file" --pdf-engine=xelatex | |
done | |
- name: Upload PDFs as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: converted-pdfs | |
path: '**/*.pdf' |