Merge pull request #99 from notional-labs/dependabot/github_actions/g… #132
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
name: Build Example PDF files | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
- name: Setup pandoc | |
env: | |
PANDOC_VERSION: "2.19.2" | |
run: | | |
wget -qO- https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz | sudo tar xzf - --strip-components 1 -C /usr/local/ | |
- name: Setup TexLive | |
env: | |
REMOTE: http://mirror.ctan.org/systems/texlive/tlnet | |
INSTALL: '/tmp/install-texlive' | |
run: | | |
mkdir -p ${INSTALL} | |
curl -sSL ${REMOTE}/install-tl-unx.tar.gz | tar -xzv -C $INSTALL --strip-components=1 | |
sudo ${INSTALL}/install-tl -no-gui -profile .texlife.profile | |
VERSION=$($INSTALL/install-tl --version | grep 'version' | grep -o '[0-9]\{4\}') | |
PLATFORM=$($INSTALL/install-tl --print-platform) | |
TEXLIVE_DIR="/usr/local/texlive/${VERSION}" | |
TEXBIN="/usr/local/texlive/${VERSION}/bin/${PLATFORM}" | |
echo "${TEXBIN}" >> $GITHUB_PATH | |
sudo chown -hR $(whoami) "$TEXLIVE_DIR" | |
- name: Initialization for tlmgr | |
run: | | |
sudo apt-get update -qq && sudo apt-get install xzdec -y | |
tlmgr init-usertree | |
- name: Setup fonts and image convertion tool | |
run: sudo apt-get update -qq && sudo apt-get install fonts-noto-cjk poppler-utils -y | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install python filters | |
run: | | |
python -m pip install --upgrade pip | |
pip install pandoc-latex-environment | |
- name: Install LaTeX packages | |
run: | | |
tlmgr install adjustbox background bidi csquotes footmisc footnotebackref fvextra mdframed pagecolor sourcecodepro sourcesanspro titling ulem upquote xurl hardwrap catchfile | |
# trial and error | |
tlmgr install letltxmacro zref everypage framed collectbox | |
# packages needed for the template | |
tlmgr install xecjk filehook unicode-math ucharcat pagecolor babel-german ly1 mweights sourcecodepro sourcesanspro mdframed needspace fvextra footmisc footnotebackref background | |
# packages only needed for some examples (that include packages via header-includes) | |
tlmgr install awesomebox fontawesome5 | |
# packages only needed for some examples (example boxes-with-pandoc-latex-environment-and-tcolorbox) | |
tlmgr install tcolorbox pgf etoolbox environ trimspaces | |
- name: Build pdf files | |
run: cd incidents && bash buildmd.bash && cd .. | |
- name: Commit files | |
run: | | |
git fetch --all | |
git add incidents/*.pdf | |
git commit -m "add generated PDF files" -a | |
git checkout gh-pages | |
git checkout master -- incidents/*.pdf | |
git add incidents/*.pdf | |
git commit -m "add generated PDF files" -a | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages |