-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a Github workflow to build PDFs and expose them as releases
- Loading branch information
Showing
2 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
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
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 |
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
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 |