-
Notifications
You must be signed in to change notification settings - Fork 15
132 lines (114 loc) · 4.26 KB
/
main.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: spellcheck
on:
push:
pull_request:
jobs:
check-spelling:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check Spelling
uses: rojopolis/[email protected]
with:
config_path: .spellcheck.yml
task_name: Markdown
build-pdf:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install PowerShell
run: |
sudo apt-get update
sudo apt-get install -y powershell
- name: Create output paths
run: |
mkdir -p ./.github/workflows/bin/temp
mkdir -p ./.github/workflows/bin/markdown
mkdir -p ./.github/workflows/bin/pdf
- name: Run PowerShell script
shell: pwsh
run: |
./scripts/Merge-MarkdownFiles.ps1
- name: Fix logo and copy images to root directory for pandoc # images directory is deleted in "Cleanup temporary items" step
run: |
cp -r ./.github/workflows/bin/markdown/images ./images
sed -i '/!\[\](images\/qlcplus\.svg)/d' ./.github/workflows/bin/markdown/qlcplus-docs.md
- name: Install ImageMagick for image normalization
run: sudo apt-get install -y imagemagick
- name: Normalize image DPI
run: |
for file in ./images/*.{jpg,jpeg,png,tiff,bmp}; do
if [[ -f "$file" ]]; then
convert "$file" -units PixelsPerInch -density 96 "$file"
echo "Processed $file"
fi
done
- name: Install GitHub CLI
run: sudo apt-get install gh
- name: Fetch Latest Release
id: get_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Set the token for GitHub CLI authentication
run: |
RELEASE=$(gh release view --json tagName --jq .tagName)
echo "LATEST_RELEASE=$RELEASE" >> $GITHUB_ENV
- name: Put current date into a variable
run: |
echo "EXPORT_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV}
- name: Build PDF
uses: docker://pandoc/extra
with:
args: >
-s -o ./.github/workflows/bin/temp/QLCplusDocumentation.pdf
./.github/workflows/bin/markdown/qlcplus-docs.md
--listings
--pdf-engine=lualatex
-V papersize=a4
-V geometry:margin=1.5cm
-V classoption=oneside
-V indent=false
-V toc=true
-V toc-title="Table of Contents"
-V mainfont="Source Sans Pro"
-V sansfont="Source Sans Pro"
-f markdown-raw_tex
- name: Create Title Page Markdown
run: |
echo '{ style="width: 50%; margin: auto;" }' >> ./.github/workflows/bin/temp/titlepage.md
- name: Convert Title Page to PDF
uses: docker://pandoc/extra
with:
args: >
-s -o ./.github/workflows/bin/temp/titlepage.pdf
./.github/workflows/bin/temp/titlepage.md
--pdf-engine=lualatex
--template=./scripts/template.tex
--verbose
-V mainfont="Source Sans Pro"
-V sansfont="Source Sans Pro"
-V title="Q Light Controller + Documentation"
-V subtitle="Comprehensive Guide"
-V author="docs.qlcplus.org"
-V date="${{env.EXPORT_DATE}}"
-V release="${{env.LATEST_RELEASE}}"
- name: Combine Title Page and Documentation PDFs
run: |
sudo apt-get update
sudo apt-get install -y ghostscript
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=./.github/workflows/bin/pdf/qlcplus-docs.pdf ./.github/workflows/bin/temp/titlepage.pdf ./.github/workflows/bin/temp/QLCplusDocumentation.pdf
- name: Cleanup temporary items
run: |
rm -rf ./.github/workflows/bin/temp/
rm -rf ./.github/workflows/bin/images/
- name: Upload-PDF
uses: actions/upload-artifact@v4
with:
name: qlcplus-docs-en-pdf
path: ./.github/workflows/bin/pdf/
- name: Upload-Markdown
uses: actions/upload-artifact@v4
with:
name: qlcplus-docs-en-markdown
path: ./.github/workflows/bin/markdown/