Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PDF generator #230

Merged
merged 1 commit into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions .github/workflows/generate-pdfs.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
name: Generate PDFs

on:
push:
branches:
- main
schedule:
- cron: "15 0 * * *" # Run daily at 00.15
workflow_dispatch:

jobs:
convert_via_pandoc:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- uses: docker://pandoc/latex:2.9
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- name: Get current branch
run: |
# Get the current branch and output as environment variable
GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' )
echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV
- name: Generate PDFs
uses: docker://pandoc/latex:2.9
with:
entrypoint: pdf-gen/gen-pdfs.sh

- name: Upload artifacts
uses: actions/upload-artifact@master
with:
args: ${{ github.action_path }}/pdf-gen/gen-pdfs.sh
name: pdf-artifacts
path: docs/pdfs/*.pdf

- uses: actions/upload-artifact@master
- name: Update PDFs on repo
uses: test-room-7/action-update-file@v1
with:
name: output
path: docs/pdfs/
branch: ${{ env.GITHUB_BRANCH }}
file-path: docs/pdfs/*.pdf
commit-msg: Update PDFs
github-token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions pdf-gen/gen-pdfs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

pandoc pdf-data.yml ../docs/indoor-hotspot/overview.md -o ../docs/pdfs/indoor-overview.pdf --pdf-engine=xelatex --resource-path ../docs/media/
pandoc pdf-data.yml ../docs/indoor-hotspot/quick-start.md -o ../docs/pdfs/indoor-quick-start.pdf --pdf-engine=xelatex --resource-path ../docs/media/
pandoc pdf-data.yml ../docs/outdoor-hotspot/overview.md -o ../docs/pdfs/outdoor-overview.pdf --pdf-engine=xelatex --resource-path ../docs/media/
pandoc pdf-data.yml ../docs/outdoor-hotspot/quick-start.md -o ../docs/pdfs/outdoor-quick-start.pdf --pdf-engine=xelatex --resource-path ../docs/media/
pandoc pdf-gen/pdf-data.yml docs/indoor-hotspot/overview.md -o docs/pdfs/indoor-overview.pdf --pdf-engine=xelatex --resource-path docs/media/
pandoc pdf-gen/pdf-data.yml docs/indoor-hotspot/quick-start.md -o docs/pdfs/indoor-quick-start.pdf --pdf-engine=xelatex --resource-path docs/media/
pandoc pdf-gen/pdf-data.yml docs/outdoor-hotspot/overview.md -o docs/pdfs/outdoor-overview.pdf --pdf-engine=xelatex --resource-path docs/media/
pandoc pdf-gen/pdf-data.yml docs/outdoor-hotspot/quick-start.md -o docs/pdfs/outdoor-quick-start.pdf --pdf-engine=xelatex --resource-path docs/media/
4 changes: 3 additions & 1 deletion pdf-gen/pdf-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ header-includes:
\usepackage{fancyhdr}
\pagestyle{fancy}
\setlength\headheight{28pt}
\fancyhead[L]{\includegraphics[width=5cm]{../docs/media/Nebra.png}}
\fancyhead[L]{\includegraphics[width=5cm]{docs/media/Nebra.png}}
\fancyfoot[LE,RO]{Nebra LTD. 2021}
fontsize: 14pt
mainfont: Ubuntu-Regular.ttf
mainfontoptions:
- Path=pdf-gen/
- BoldFont=Ubuntu-Bold.ttf
- ItalicFont=Ubuntu-Italic.ttf
- BoldItalicFont=Ubuntu-BoldItalic.ttf
monofont: UbuntuMono-Regular.ttf
monofontoptions:
- Path=pdf-gen/
- BoldFont=UbuntuMono-Bold.ttf
- ItalicFont=UbuntuMono-Italic.ttf
- BoldItalicFont=UbuntuMono-BoldItalic.ttf
Expand Down