---
# .github/workflows/ci-build.yaml

# [Markdown to PDF](https://github.com/BaileyJM02/markdown-to-pdf)
name: Docs to PDF
# This workflow is triggered on pushes to the repository.
on:
  workflow_call:
  workflow_dispatch:
  # push:
  #   branches:
  #     - main
  #   # Paths can be used to only trigger actions when you have edited certain files, such as a file within the /docs directory
  #   paths:
  #     - "docs/**.md"
  #     - "docs/images/**"

jobs:
  build:
    name: Build PDF
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Convert Markdown to PDF
        uses: baileyjm02/markdown-to-pdf@v1
        with:
          input_path: docs
          output_dir: docs/pdfs
          images_dir: docs/images
          # for example <img src="./images/file-name.png">
          image_import: ./images
          # Default is true, can set to false to only get PDF files
          build_html: false
      - name: Upload PDFs as Artifacts
        uses: actions/upload-artifact@v3
        with:
          name: docs
          path: docs/pdfs
