-
Notifications
You must be signed in to change notification settings - Fork 8
55 lines (49 loc) · 1.53 KB
/
create-pdf-on-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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.pdf
docs/wallet-safety-guide.md
- uses: softprops/action-gh-release@v2
with:
files: wallet-safety-guide.pdf