-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (107 loc) · 3.78 KB
/
generate_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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
on: [push]
jobs:
create_draft_release:
runs-on: ubuntu-latest
outputs:
id: ${{ steps.create_draft_release.outputs.id }}
steps:
- name: Create draft release on tags
id: create_draft_release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
latex-job:
needs: create_draft_release
runs-on: ubuntu-latest
name: Compile And Upload PDF
steps:
- name: checkout
uses: actions/checkout@v2
- name: set git user
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
- name: define env
run: |
echo "GITHUB_TAG=$(git describe --always --tags)" >> $GITHUB_ENV
echo "BUILD_DATE=$(date +'%Y_%m_%d')" >> $GITHUB_ENV
- name: prepare env
run: |
sudo apt update
sudo apt install fonts-opendyslexic fonts-texgyre texlive-bibtex-extra texlive-luatex texlive-xetex texlive-latex-recommended texlive-latex-base texlive-latex-extra texlive-fonts-extra texlive-science poppler-utils
sudo rm -rf /usr/share/fonts/woff/opendyslexic
sudo fc-cache
- name: show Open* fonts
run: fc-list :outline -f "%{family}\n" | grep Open
- name: compile
run: |
xelatex -interaction=nonstopmode hm.tex || true
bibtex hm
makeindex hm
xelatex -interaction=nonstopmode hm.tex || true
xelatex -interaction=nonstopmode hm.tex
- name: rename tg
run: |
mkdir assets
mv hm.pdf assets/hm-tg.pdf
# - name: upload PDF
# if: ${{ success() }}
# uses: actions/upload-artifact@v2
# with:
# path: assets/hm-tg.pdf
# name: hm-tg-${{ env.BUILD_DATE }}-${{ env.GITHUB_TAG }}.pdf
# if-no-files-found: error
- name: use OpenDyslxic
run: git apply ci0.patch
- name: compile again
run: |
xelatex -interaction=nonstopmode hm.tex || true
bibtex hm
makeindex hm
xelatex -interaction=nonstopmode hm.tex || true
xelatex -interaction=nonstopmode hm.tex
- name: rename od
run: mv hm.pdf assets/hm-od.pdf
# - name: upload PDF
# if: ${{ success() }}
# uses: actions/upload-artifact@v2
# with:
# path: assets/hm-tg.pdf
# name: hm-tg-${{ env.BUILD_DATE }}-${{ env.GITHUB_TAG }}.pdf
# if-no-files-found: error
- name: upload assets
if: ${{ success() && startsWith(github.ref, 'refs/tags/') }}
id: upload-release-assets
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.create_draft_release.outputs.id }}
assets_path: assets/
- name: remove font customization for html version
run: git apply ci1.patch
- name: compile html
run: |
lwarpmk pdftosvg images/*.pdf
lwarpmk html
lwarpmk limages
bibtex hm_html
lwarpmk printindex
lwarpmk html1
- name: prepare for deployment
run: |
mkdir public
mv hm-images/ images/ chapter*.html index.html *.css public/
- name: deploy release
if: ${{ success() && startsWith(github.ref, 'refs/tags/') }}
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: master
publish_dir: ./public