Skip to content

Docs to PDF

Docs to PDF #14

name: Docs to PDF
# This workflow is triggered on published releases
on:
release:
types: [published]
jobs:
convert_via_pandoc:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# Create lua file
- name: Create linebreaks.lua
run: |
cat <<EOF > linebreaks.lua
--- Transform a raw HTML element which contains only a `<br>`
-- into a format-indepentent line break.
function RawInline (el)
if el.format:match '^html' and el.text:match '%<br ?/?%>' then
return pandoc.LineBreak()
end
end
EOF
# Create header.tex file
- name: Create header.tex
run: |
cat <<EOF > header.tex
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.5pt}
\fancyhead[R,C,L]{}
\fancyfoot[R]{\thepage}
\fancyfoot[C]{}
\fancyfoot[L]{Copyright (c) OpenWallet Foundation 2024- \\\\ License:CC-BY-4.0}
EOF
# Convert GitHub markdown to PDF with 1 inch margins
- uses: docker://pandoc/latex:3.2.0
with:
args: >-
-f markdown_github
-t pdf
-V geometry:margin=1in
-L linebreaks.lua
-H header.tex
--output=wallet-safety-guide-and-checklist.pdf
docs/wallet-safety-guide-and-checklist.md
- uses: softprops/action-gh-release@v2
with:
files: wallet-safety-guide-and-checklist.pdf