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

[setup](build): GitHub Copilot created this from Makefile #113

Merged
merged 1 commit into from
Jan 7, 2025
Merged
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
76 changes: 76 additions & 0 deletions .github/workflows/pandoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Pandoc
run: |
sudo apt-get install -y pandoc context

- name: Initialize directories
run: mkdir -p output

- name: Check Pandoc version
id: version
run: |
PANDOC_VERSION=$(pandoc --version | head -1 | cut -d' ' -f2 | cut -d'.' -f1)
if [ "$PANDOC_VERSION" -eq "2" ]; then
echo "::set-output name=smart_flag;-smart"
else
echo "::set-output name=smart_flag;--smart"
fi

- name: Build HTML
run: |
for f in markdown/*.md; do
FILE_NAME=$(basename "$f" | sed 's/.md//g')
pandoc --standalone --include-in-header styles/chmduquesne.css \
--lua-filter=pdc-links-target-blank.lua \
--from markdown --to html \
--output output/${FILE_NAME}.html $f \
--metadata pagetitle=$FILE_NAME
done

- name: Build PDF
run: |
for f in markdown/*.md; do
FILE_NAME=$(basename "$f" | sed 's/.md//g')
pandoc --standalone --template styles/chmduquesne.tex \
--from markdown --to context \
--variable papersize=A4 \
--output output/${FILE_NAME}.tex $f
mtxrun --path=output --result=${FILE_NAME}.pdf --script context ${FILE_NAME}.tex
done

- name: Build DOCX
run: |
for f in markdown/*.md; do
FILE_NAME=$(basename "$f" | sed 's/.md//g')
pandoc --standalone ${{ steps.version.outputs.smart_flag }} $f --output output/${FILE_NAME}.docx
done

- name: Build RTF
run: |
for f in markdown/*.md; do
FILE_NAME=$(basename "$f" | sed 's/.md//g')
pandoc --standalone ${{ steps.version.outputs.smart_flag }} $f --output output/${FILE_NAME}.rtf
done

- name: Upload output
uses: actions/upload-artifact@v2
with:
name: output
path: output
Loading