Add GitHub actions (#267)

Add GitHub actions
This commit is contained in:
Wen Wei Tseng 2021-11-14 18:08:38 +08:00 committed by GitHub
parent 6baf692c89
commit 328c589bc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

75
.github/workflows/build-examples.yml vendored Normal file
View File

@ -0,0 +1,75 @@
name: Build Example PDF files
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup pandoc
env:
PANDOC_VERSION: "2.11.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@v2
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
# 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 examples && bash build-examples.sh && cd ..
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: build-files
path: |
examples/*/document.pdf
examples/*/preview.png
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Add changes" -a
- name: Push changes
uses: ad-m/github-push-action@master
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}