Skip to content

Commit 0468f03

Browse files
[setup](build): GitHub Copilot created this from M (#113)
Signed-off-by: Ralph Hightower <[email protected]>
1 parent 03d9dde commit 0468f03

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflows/pandoc.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Pandoc
20+
run: |
21+
sudo apt-get install -y pandoc context
22+
23+
- name: Initialize directories
24+
run: mkdir -p output
25+
26+
- name: Check Pandoc version
27+
id: version
28+
run: |
29+
PANDOC_VERSION=$(pandoc --version | head -1 | cut -d' ' -f2 | cut -d'.' -f1)
30+
if [ "$PANDOC_VERSION" -eq "2" ]; then
31+
echo "::set-output name=smart_flag;-smart"
32+
else
33+
echo "::set-output name=smart_flag;--smart"
34+
fi
35+
36+
- name: Build HTML
37+
run: |
38+
for f in markdown/*.md; do
39+
FILE_NAME=$(basename "$f" | sed 's/.md//g')
40+
pandoc --standalone --include-in-header styles/chmduquesne.css \
41+
--lua-filter=pdc-links-target-blank.lua \
42+
--from markdown --to html \
43+
--output output/${FILE_NAME}.html $f \
44+
--metadata pagetitle=$FILE_NAME
45+
done
46+
47+
- name: Build PDF
48+
run: |
49+
for f in markdown/*.md; do
50+
FILE_NAME=$(basename "$f" | sed 's/.md//g')
51+
pandoc --standalone --template styles/chmduquesne.tex \
52+
--from markdown --to context \
53+
--variable papersize=A4 \
54+
--output output/${FILE_NAME}.tex $f
55+
mtxrun --path=output --result=${FILE_NAME}.pdf --script context ${FILE_NAME}.tex
56+
done
57+
58+
- name: Build DOCX
59+
run: |
60+
for f in markdown/*.md; do
61+
FILE_NAME=$(basename "$f" | sed 's/.md//g')
62+
pandoc --standalone ${{ steps.version.outputs.smart_flag }} $f --output output/${FILE_NAME}.docx
63+
done
64+
65+
- name: Build RTF
66+
run: |
67+
for f in markdown/*.md; do
68+
FILE_NAME=$(basename "$f" | sed 's/.md//g')
69+
pandoc --standalone ${{ steps.version.outputs.smart_flag }} $f --output output/${FILE_NAME}.rtf
70+
done
71+
72+
- name: Upload output
73+
uses: actions/upload-artifact@v2
74+
with:
75+
name: output
76+
path: output

0 commit comments

Comments
 (0)