-
Notifications
You must be signed in to change notification settings - Fork 9
94 lines (86 loc) · 3.82 KB
/
pdf.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
on:
push:
branches:
- master
jobs:
build-and-gen-pdf:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Github Action'
uses: actions/checkout@master
- 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: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Caching yarn
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-
- name: Installing dependencies
run: yarn install
- name: Prepare markdown
run: |
node scripts/prepareMarkdown.js
- name: Convert PDF
run: |
scripts/pdf.sh
- 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 add pdf
git commit -m "Generate codelabs' PDF"
- name: Push changes
uses: ad-m/github-push-action@master
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.ref }}