Skip to content

Commit

Permalink
Added a Github workflow to build PDFs and expose them as releases
Browse files Browse the repository at this point in the history
  • Loading branch information
madacol committed Sep 29, 2022
1 parent 8b03726 commit 6be6eba
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 13 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build

on: push

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install pandoc
run: |
sudo apt-get update
sudo apt-get install pandoc wkhtmltopdf
- name: Build
run: ./build.sh profiles/*.md
- name: Release
uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
with:
files: profiles/*.pdf
35 changes: 22 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
#!/usr/bin/env bash

# exit if file does not have '*.md' extension
if [[ "$1" != *.md ]]; then
echo "Error: file must have '*.md' extension."
exit 1
fi
for inputFile in "$@"
do

# replace '.md' with '.pdf'
filename=${1%.*}.pdf
echo "Parsing \"$inputFile\""

pandoc <(./parseImport.sh "$1") -o "$filename" --pdf-engine wkhtmltopdf \
--css styles.css \
-V margin-top=11mm \
-V margin-bottom=11mm \
-V margin-left=11mm \
-V margin-right=11mm
# exit if file does not have '*.md' extension
if [[ "$inputFile" != *.md ]]; then
echo "Error: file must have '*.md' extension."
exit 1
fi

# replace '.md' with '.pdf'
outputFile=${inputFile%.*}.pdf

echo "Generating \"$outputFile\""

pandoc <(./parseImport.sh "$inputFile") -o "$outputFile" --pdf-engine wkhtmltopdf \
--css styles.css \
-V margin-top=11mm \
-V margin-bottom=11mm \
-V margin-left=11mm \
-V margin-right=11mm

done

0 comments on commit 6be6eba

Please sign in to comment.