-
Notifications
You must be signed in to change notification settings - Fork 0
199 lines (197 loc) · 7.24 KB
/
build-docs.yaml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Build PST package documentation
on:
push:
branches:
- trunk
tags:
- "*"
jobs:
texlive-cache:
runs-on: ubuntu-latest
name: Update TeX Live
outputs:
cache_key: ${{ steps.texlive.outputs.cache_key }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install TeX Live
id: texlive
uses: zauguin/install-texlive@experiment
with:
tlcontrib: "true"
package_file: .github/tl_packages
profile: .github/texlive.profile
build-docs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# - path: generic/pstricks
# document: pst-user
# patch: pst-user.diff
# extra-command: tar xzf pst-user.tgz
- path: generic/pstricks-add
document: pstricks-add-doc
patch: add_documentmetadata.diff
- path: generic/pst-3d
document: pst-3d-doc
patch: pst-3d.diff
- path: generic/pst-3dplot
document: pst-3dplot-doc
patch: pst-3dplot.diff
- path: generic/pst-am
document: pst-am-doc
patch: pst-am.diff
extra-command: iconv -f ISO_8859-15 -t UTF-8 pst-am-doc.tex | sponge pst-am-doc.tex
- path: generic/pst-antiprism
document: pst-antiprism-doc
patch: add_documentmetadata.diff
- path: generic/pst-barcode
document: pst-barcode-doc
extension: ltx
- path: generic/pst-bezier
document: pst-bezier-doc
patch: add_documentmetadata.diff
- path: generic/pst-cie
document: pst-cie-doc
- path: generic/pst-circ
document: pst-circ-doc
- path: generic/pst-coil
document: pst-coil-doc
patch: pst-coil.diff
- path: generic/pst-dart
document: pst-dart-doc
- path: generic/pst-eucl
document: pst-eucl-doc
patch: pst-eucl.diff
- path: generic/pst-func
document: pst-func-doc
- path: generic/pst-knot
document: pst-knot-doc
patch: pst-knot.diff
extra-command: cp ~/texlive/texmf-dist/doc/generic/pst-func/pst-func-doc.bib .
- path: generic/pst-node
document: pst-node-doc
- path: generic/pst-ovl
document: pst-ovl-doc
patch: add_documentmetadata.diff
- path: generic/pst-platon
document: pst-platon-doc
patch: pst-platon.diff
- path: generic/pst-plot
document: pst-plot-doc
- path: generic/pst-poly
document: pst-poly-doc
patch: pst-poly.diff
- path: generic/pst-solarsystem
document: pst-solarsystem-doc
patch: add_documentmetadata.diff
- path: generic/pst-soroban
document: pst-soroban-doc
patch: pst-soroban.diff
- path: generic/pst-spinner
document: pst-spinner-doc
patch: add_documentmetadata.diff
- path: generic/pst-stru
document: pst-stru-doc
patch: pst-stru.diff
- path: generic/pst-tools
document: pst-tools-doc
- path: generic/pst-tree
document: pst-tree-doc
- path: generic/pst-turtle
document: pst-turtle-doc
patch: add_documentmetadata.diff
- path: generic/pst-vehicle
document: pst-vehicle-doc
patch: pst-vehicle.diff
- path: generic/pst-venn
document: pst-venn-doc
patch: add_documentmetadata.diff
name: "${{ matrix.document }}"
needs: texlive-cache
steps:
- run: sudo apt update && sudo apt -y install moreutils ghostscript
- name: Checkout repository
uses: actions/checkout@v3
with:
path: luapstricks
- name: Restore TeX Live from cache
uses: actions/cache/restore@v3
with:
path: ~/texlive
key: ${{ needs.texlive-cache.outputs.cache_key }}
fail-on-cache-miss: true
- run: echo $HOME/texlive/bin/x86_64-linux >> $GITHUB_PATH
- run: l3build install
working-directory: luapstricks
- run: cp -R "$HOME/texlive/texmf-dist/doc/${{ matrix.path }}" document_dir
- run: cp -R "$HOME/texlive/texmf-dist/doc/generic/pstricks/pst-doc.pdf" document_dir
- name: Run extra command
if: matrix.extra-command
working-directory: document_dir
run: "${{ matrix.extra-command }}"
- name: Patch documentation
if: matrix.patch
working-directory: document_dir
run: patch "${{ matrix.document }}.${{ matrix.extension || 'tex' }}" "${{ github.workspace }}/luapstricks/.github/doc_patches/${{ matrix.patch }}"
- name: Run latexmk
working-directory: document_dir
run: "latexmk -pdflua ${{ matrix.document }}.${{ matrix.extension || 'tex' }}"
- name: Save resulting document
uses: actions/upload-artifact@v3
with:
name: documentation
retention-days: 1
path: document_dir/${{ matrix.document }}.pdf
deploy:
runs-on: ubuntu-latest
name: Deploy to Pages branch
needs: build-docs
if: github.ref_type == 'branch'
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: refs/heads/gh-pages
- name: Delete old files in target directory
run: rm -Rf "static/version/${{ github.ref_name }}"
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: documentation
path: static/version/${{ github.ref_name }}/doc
- name: Commit and push new Page
run: git add "static/version/${{ github.ref_name }}" && git commit -m "Generated documentation from ${{ github.sha }}" && git push origin @:refs/heads/gh-pages
env:
GIT_AUTHOR_NAME: "${{ github.event.head_commit.author.name }}"
GIT_AUTHOR_EMAIL: "${{ github.event.head_commit.author.email }}"
GIT_COMMITTER_NAME: "${{ github.event.head_commit.committer.name }}"
GIT_COMMITTER_EMAIL: "${{ github.event.head_commit.committer.email }}"
- name: Trigger pusblishing workflow
run: gh workflow run deploy-page.yaml --ref gh-pages
env:
GH_TOKEN: ${{ github.token }}
# We could use the same workflow here as for branches and just push into the gh-pages branch,
# but then we would collect a huge number of files in there, wasting space.
release:
runs-on: ubuntu-latest
name: Create GitHub release
needs: build-docs
if: github.ref_type == 'tag'
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: documentation
- name: Create GitHub release
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e
with:
artifacts: "*.pdf"
artifactContentType: application/pdf
token: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger pusblishing workflow
run: gh workflow run deploy-page.yaml --repo "$GITHUB_REPOSITORY" --ref gh-pages
env:
GH_TOKEN: ${{ github.token }}