Improvements to pdf generation script #299
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Run PowerShell script | |
shell: pwsh | |
run: | | |
./scripts/Merge-MarkdownFiles.ps1 | |
- name: Copy images folder to root directory | |
run: | | |
cp -r ./.github/workflows/bin/images ./images | |
sed -i '/!\[\](images\/qlcplus\.svg)/d' ./.github/workflows/bin/combined_documentation.md | |
- 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/QLCplusDocumentation.pdf | |
./.github/workflows/bin/combined_documentation.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/titlepage.md | |
- name: Convert Title Page to PDF | |
uses: docker://pandoc/extra | |
with: | |
args: > | |
-s -o ./.github/workflows/bin/titlepage.pdf | |
./.github/workflows/bin/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/QLCplusDocumentation_with_titlepage.pdf ./.github/workflows/bin/titlepage.pdf ./.github/workflows/bin/QLCplusDocumentation.pdf | |
- name: Upload-Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: qlcplus-docs-build | |
path: ./.github/workflows/bin/ |