From 0468f03bb07cb3e8d6bdb0ffbed09390f6babfbf Mon Sep 17 00:00:00 2001 From: Ralph Hightower <32745442+RalphHightower@users.noreply.github.com> Date: Tue, 7 Jan 2025 15:17:32 -0500 Subject: [PATCH] [setup](build): GitHub Copilot created this from M (#113) Signed-off-by: Ralph Hightower <32745442+RalphHightower@users.noreply.github.com> --- .github/workflows/pandoc.yml | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/pandoc.yml diff --git a/.github/workflows/pandoc.yml b/.github/workflows/pandoc.yml new file mode 100644 index 00000000..88672607 --- /dev/null +++ b/.github/workflows/pandoc.yml @@ -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 \ No newline at end of file