-
Notifications
You must be signed in to change notification settings - Fork 0
322 lines (253 loc) · 9.5 KB
/
Copy pathmain.yml
File metadata and controls
322 lines (253 loc) · 9.5 KB
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
name: Compile, test, and upload
on:
push:
branches: [ main ]
paths-ignore:
- "README.md"
- "CONTRIBUTING.md"
- "LICENSE"
- ".github/ISSUE_TEMPLATE/**"
- ".gitignore"
pull_request:
paths-ignore:
- "README.md"
- "CONTRIBUTING.md"
- "LICENSE"
- ".github/ISSUE_TEMPLATE/**"
- ".gitignore"
workflow_dispatch:
jobs:
build_environment:
name: Obtain build environment information
runs-on: ubuntu-latest
outputs:
texlive_digest: ${{ steps.get_digest.outputs.texlive_digest }}
timestamp: ${{ steps.get_timestamp.outputs.timestamp }}
commitsha: ${{ steps.get_sha.outputs.commitsha }}
steps:
- name: Fetch latest TeXLive Docker image digest
id: get_digest
run: echo "texlive_digest=$(docker manifest inspect texlive/texlive:latest | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')" >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v6
- name: Fetch latest commit timestamp
id: get_timestamp
run: echo "timestamp=$(git log -1 --pretty=%ct)" >> $GITHUB_OUTPUT
- name: Fetch commit SHA
id: get_sha
run: echo "commitsha=${{ github.sha }}" >> $GITHUB_OUTPUT
environment:
name: Record build environment
needs: build_environment
runs-on: ubuntu-latest
steps:
- name: Write build environment information to file
run: |
echo "Reproducible builds information" >> "build_env.txt"
echo "" >> "build_env.txt"
echo "TeXLive Docker image: texlive/texlive@${{ needs.build_environment.outputs.texlive_digest }}" >> "build_env.txt"
echo "SOURCE_DATE_EPOCH: ${{ needs.build_environment.outputs.timestamp }}" >> "build_env.txt"
echo "Commit SHA: ${{ needs.build_environment.outputs.commitsha }}" >> "build_env.txt"
echo "Workflow run ID: ${{ github.run_id }}" >> "build_env.txt"
echo "" >> "build_env.txt"
echo "Compilation information for each target:" >> "build_env.txt"
- name: Upload build environment information
uses: actions/upload-artifact@v7
with:
name: build-environment
path: build_env.txt
process_targets:
name: Process
needs: build_environment
strategy:
fail-fast: false
matrix:
include:
# Files for testing only
- target: '_u'
flags: ''
pre_tex: '\def\ALL{} \def\MOREREFS{} \def\FORUMREFS{}'
flavours: '2u'
publish: false
- target: '_UA'
flags: ''
pre_tex: '\def\ALL{} \def\MOREREFS{} \def\FORUMREFS{} \def\TAGPDF{}'
flavours: '4f ua2 wt1r wt1a'
publish: false
- target: '_A'
flags: ''
pre_tex: '\def\ALL{} \def\MOREREFS{} \def\FORUMREFS{} \def\PDFAA{}'
flavours: '3a ua1'
publish: false
- target: '_p'
flags: '-pdflatex'
pre_tex: '\def\ALL{} \def\MOREREFS{} \def\FORUMREFS{}'
flavours: '2u'
publish: false
# Problems and solutions
- target: '_problems_and_solutions'
flags: ''
pre_tex: '\def\TAGPDF{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
- target: '_problems_and_solutions_minimal'
flags: ''
pre_tex: '\def\TAGPDF{} \def\MINIMAL{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
# Problems only
- target: '_problems_no_solutions'
flags: ''
pre_tex: '\def\TAGPDF{} \def\NOSOLUTIONS{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
- target: '_problems_no_solutions_minimal'
flags: ''
pre_tex: '\def\TAGPDF{} \def\NOSOLUTIONS{} \def\MINIMAL{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
# Solutions
- target: '_solutions'
flags: ''
pre_tex: '\def\TAGPDF{} \def\ONLYSOLUTIONS{} \def\NOSOURCES{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
- target: '_solutions_minimal'
flags: ''
pre_tex: '\def\TAGPDF{} \def\ONLYSOLUTIONS{} \def\MINIMAL{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
# Generalised problems and solutions
- target: '_generalised_problems_and_solutions'
flags: ''
pre_tex: '\def\TAGPDF{} \def\GENERALISED{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
- target: '_generalised_problems_and_solutions_minimal'
flags: ''
pre_tex: '\def\TAGPDF{} \def\GENERALISED{} \def\MINIMAL{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
# Generalised problems only
- target: '_generalised_problems_no_solutions'
flags: ''
pre_tex: '\def\TAGPDF{} \def\GENERALISED{} \def\NOSOLUTIONS{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
- target: '_generalised_problems_no_solutions_minimal'
flags: ''
pre_tex: '\def\TAGPDF{} \def\GENERALISED{} \def\NOSOLUTIONS{} \def\MINIMAL{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
# Solutions to the generalised problems
- target: '_generalised_solutions'
flags: ''
pre_tex: '\def\TAGPDF{} \def\GENERALISED{} \def\ONLYSOLUTIONS{} \def\NOSOURCES{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
- target: '_generalised_solutions_minimal'
flags: ''
pre_tex: '\def\TAGPDF{} \def\GENERALISED{} \def\ONLYSOLUTIONS{} \def\MINIMAL{}'
flavours: '4f ua2 wt1r wt1a'
publish: true
uses: ./.github/workflows/process.yml
with:
texlive_digest: ${{ needs.build_environment.outputs.texlive_digest }}
timestamp: ${{ needs.build_environment.outputs.timestamp }}
target: coffins${{ matrix.target }}
flags: ${{ matrix.flags }}
pre_tex: ${{ matrix.pre_tex }}
flavours: ${{ matrix.flavours }}
publish: ${{ matrix.publish }}
upload:
name: Deploy to GitHub Pages
needs: [environment, process_targets]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- name: Create directory for documents to be published
run: sudo mkdir publish
- name: Download PDFs
uses: actions/download-artifact@v8
with:
path: .
pattern: pdf-first-build-publish-true-*
merge-multiple: true
- name: Copy primary pdf under simpler name
run: sudo cp coffins_problems_and_solutions.pdf coffins.pdf
- name: Move PDFs to publish directory
run: sudo mv *.pdf ./publish
- name: Download ebooks
uses: actions/download-artifact@v8
with:
path: .
pattern: ebook-publish-true-*
merge-multiple: true
- name: Move ebooks to publish directory
run: sudo mv *.epub ./publish
- name: Download build environment information
uses: actions/download-artifact@v8
with:
name: build-environment
path: .
- name: Move build environment information file to publish directory
run: sudo mv build_env.txt ./publish
- name: Download compilation information
uses: actions/download-artifact@v8
with:
path: .
pattern: compilation-info-*
merge-multiple: true
- name: Aggregate build environment and compilation information
run: sudo cat ./*.txt >> ./publish/build_env.txt
- name: Setup GitHub Pages
uses: actions/configure-pages@v6
- name: Upload artifacts to GitHub Pages
uses: actions/upload-pages-artifact@v5
with:
path: publish
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
sync-alt:
name: Sync changes from 'main' to 'alt' branch
needs: process_targets
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout everything
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Sync alt branch
run: |
git fetch origin
git switch alt
git read-tree -u -m origin/main
# Use the include_problems.tex file that does not use \QueryFiles
git restore --source=origin/alt -- src/commands/include_problems.tex
# Rename the directories for the categories
shopt -s nullglob
i=1
while true; do
sections=("./src/sections/${i}_"*)
if (( ${#sections[@]} == 0 )); then
break
fi
sudo mv "${sections[0]}" "./src/sections/section_${i}"
((i++))
done
# Remove the line "\usepackage{l3sys-query}" from preamble/preamble.tex
sudo sed -i '/\\usepackage{l3sys-query}/d' ./src/preamble/preamble.tex
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
if ! git diff --cached --quiet; then
git commit --author="$(git log -1 --pretty=format:'%an' origin/main)" -m "Sync: $(git log -1 --pretty=%s origin/main)"
git push origin alt
fi