-
Notifications
You must be signed in to change notification settings - Fork 127
448 lines (371 loc) · 15 KB
/
Copy pathbuild.yaml
File metadata and controls
448 lines (371 loc) · 15 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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
on:
workflow_dispatch:
inputs:
ctan_repo:
description: 'CTAN repository URL. See https://ctan.org/mirrors/mirmon for available mirrors.'
required: false
type: string
default: 'https://tlnet.yihui.org'
force_rebuild_tinytex2:
description: 'Force a full rebuild of TinyTeX-2 (ignore existing daily bundle)'
required: false
type: boolean
default: false
schedule:
- cron: '5 3 * * *'
name: Build TinyTeX Bundles
env:
# for gh usage with external repo
GH_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
# required for GH to run on another repo (-R option)
# https://cli.github.com/manual/gh_help_environment
GH_REPO: rstudio/tinytex-releases
# CTAN repository URL for TeX Live packages
CTAN_REPO: ${{ inputs.ctan_repo || 'https://tlnet.yihui.org' }}
# Force full rebuild of TinyTeX-2 even if the daily bundle year matches
FORCE_REBUILD: ${{ inputs.force_rebuild_tinytex2 == true && 'true' || 'false' }}
USE_BUNDLED_LIBUV: 1
jobs:
validate-ctan:
runs-on: ubuntu-latest
name: Validate CTAN repository
outputs:
texlive-year: ${{ steps.check-repo.outputs.texlive-year }}
steps:
- name: Check CTAN repository accessibility
id: check-repo
run: |
echo "Validating CTAN repository: $CTAN_REPO"
# Check if the repository is accessible by fetching the texlive.tlpdb file
if ! curl --fail --silent --show-error --head "$CTAN_REPO/tlpkg/texlive.tlpdb" > /dev/null; then
echo "✗ CTAN repository is not accessible or invalid"
echo "Please check the URL: $CTAN_REPO"
exit 1
fi
echo "✓ CTAN repository is valid and accessible"
# Detect TeX Live version by checking for TEXLIVE_YYYY files
echo "Detecting TeX Live version..."
CURRENT_YEAR=$(date +%Y)
TEXLIVE_YEAR=""
# Check current year first, then previous year
for year in $CURRENT_YEAR $((CURRENT_YEAR - 1)); do
if curl --fail --silent --show-error --head "$CTAN_REPO/TEXLIVE_$year" > /dev/null 2>&1; then
TEXLIVE_YEAR=$year
break
fi
done
if [ -n "$TEXLIVE_YEAR" ]; then
echo "✓ TeX Live version: $TEXLIVE_YEAR"
echo "texlive-year=$TEXLIVE_YEAR" >> $GITHUB_OUTPUT
else
echo "⚠ Could not detect version with current/previous year, checking older versions..."
# Check for older TEXLIVE_YYYY files (going back 5 years)
for offset in {2..5}; do
year=$((CURRENT_YEAR - offset))
if curl --fail --silent --show-error --head "$CTAN_REPO/TEXLIVE_$year" > /dev/null 2>&1; then
TEXLIVE_YEAR=$year
break
fi
done
if [ -n "$TEXLIVE_YEAR" ]; then
echo "✓ TeX Live version: $TEXLIVE_YEAR"
echo "texlive-year=$TEXLIVE_YEAR" >> $GITHUB_OUTPUT
else
echo "⚠ Warning: Could not detect TeX Live version (no TEXLIVE_YYYY file found)"
echo "texlive-year=unknown" >> $GITHUB_OUTPUT
fi
fi
new-release:
needs: [validate-ctan]
runs-on: ubuntu-latest
name: Create new daily draft release
outputs:
tag: ${{ steps.draft.outputs.tag }}
draft-tag: ${{ steps.draft.outputs.draft-tag }}
steps:
- name: Create new draft release
id: draft
run: |
tag=daily
url=$(gh release create ${tag} --draft --prerelease --title "TinyTeX daily build" --notes "(WIP) Next daily release")
echo "draft-tag=$(echo $url | grep -o tag/[^/]*$ | cut -c 5-)" >> $GITHUB_OUTPUT
echo "tag=${tag}" >> $GITHUB_OUTPUT
build-windows:
needs: [validate-ctan, new-release]
runs-on: windows-latest
name: Build Bundles For Windows
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Clone repo
uses: actions/checkout@HEAD
- name: Setup R for build
uses: ./.github/actions/setup-r-for-build
- name: Add TinyTeX to PATH
run: |
echo "$APPDATA\TinyTeX\bin\windows" >> $GITHUB_PATH
shell: bash
- name: Build TinyTeX-0
run: |
Rscript "tools/install-windows-base.R" # the infraonly scheme
7z a -sfx TinyTeX-0-windows.exe $Env:APPDATA\\TinyTeX
- name: Build TinyTeX-1
run: |
Rscript "tools/install-windows-more.R" # extra packages for compiling R Markdown
7z a -sfx TinyTeX-1-windows.exe $Env:APPDATA\\TinyTeX
- name: Build TinyTeX
run: |
Rscript "tools/test-basic.R" # even more LaTeX packages
7z a -sfx TinyTeX-windows.exe $Env:APPDATA\\TinyTeX
7z a TinyTeX.zip $Env:APPDATA\\TinyTeX
- name: Build TinyTeX-2
id: build-tinytex-2
env:
TEXLIVE_YEAR: ${{ needs.validate-ctan.outputs.texlive-year }}
run: "& tools/build-tinytex-2.ps1"
shell: pwsh
- name: Package TinyTeX-2
if: steps.build-tinytex-2.outputs.tinytex2-changed != 'false'
run: 7z a -sfx TinyTeX-2-windows.exe $Env:APPDATA\\TinyTeX
- name: Test Installation script
env:
TINYTEX_INSTALLER: TinyTeX-0
run: tools/install-bin-windows.ps1
shell: pwsh
- name: Upload bundles
uses: ./.github/actions/upload-bundles
with:
draft-tag: ${{ needs.new-release.outputs.draft-tag }}
build-linux:
needs: [validate-ctan, new-release]
name: Build Bundles For Linux
runs-on: ubuntu-latest
outputs:
tlmgr-version: ${{ steps.tlmgr-version.outputs.TLMGR_VERSION }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Clone repo
uses: actions/checkout@HEAD
- name: Setup R for build
uses: ./.github/actions/setup-r-for-build
- name: Build texlive-local-deb
run: |
sudo apt install -y equivs
wget https://cdn.jsdelivr.net/gh/scottkosty/install-tl-ubuntu/debian-control-texlive-in.txt
equivs-build debian-*
mv texlive-local*.deb texlive-local.deb
- name: Build TinyTeX-0
run: |
sed -i 's|# finished base|cp $OLDPWD/install-tl-unx.tar.gz tools/; Rscript tools/clean-tlpdb.R; tar Jcf TinyTeX-0-linux-x86_64.tar.xz -C ~ .TinyTeX|' tools/install-unx.sh
./tools/install-unx.sh
# tlmgr path add will add in this folder which is not on PATH by default
# (can be checked with tlmgr options sys_bin)
echo "$HOME/bin" >> $GITHUB_PATH
ls -lisah "$HOME/bin"
- name: Build TinyTeX-1
run: |
Rscript "tools/clean-tlpdb.R"
tar Jcf TinyTeX-1-linux-x86_64.tar.xz -C ~ .TinyTeX
tar zcf TinyTeX-1-tar.gz -C ~ .TinyTeX
- name: Build TinyTeX
run: |
Rscript "tools/test-basic.R"
tar Jcf TinyTeX-linux-x86_64.tar.xz -C ~ .TinyTeX
tar zcf TinyTeX.tar.gz -C ~ .TinyTeX
- name: Build TinyTeX-2
id: build-tinytex-2
env:
TEXLIVE_YEAR: ${{ needs.validate-ctan.outputs.texlive-year }}
run: sh tools/build-tinytex-2.sh
- name: Package TinyTeX-2
if: steps.build-tinytex-2.outputs.tinytex2-changed != 'false'
run: tar Jcf TinyTeX-2-linux-x86_64.tar.xz -C ~ .TinyTeX
- name: Export Regex file
run: |
Rscript "tools/export-regex.R"
tar zcf regex.tar.gz regex.json
- name: Build *nix installer bundle
working-directory: tools
run: |
cp install-base.sh install.sh
echo "tlmgr install $(cat pkgs-custom.txt | tr '\n' ' ')" >> install.sh
tar zcf ../installer-unix.tar.gz install-tl-unx.tar.gz tinytex.profile install.sh
- name: Get Version information for daily build
id: tlmgr-version
run: |
echo "TLMGR_VERSION<<EOFTLMGR" >> $GITHUB_OUTPUT
~/bin/tlmgr version | sed -n '1p;3p' >> $GITHUB_OUTPUT
echo "EOFTLMGR" >> $GITHUB_OUTPUT
- run: ls -lisah
- name: Upload bundles
uses: ./.github/actions/upload-bundles
with:
draft-tag: ${{ needs.new-release.outputs.draft-tag }}
build-linux-arm64:
needs: [validate-ctan, new-release]
name: Build Bundles For Linux ARM64
runs-on: ubuntu-24.04-arm
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Clone repo
uses: actions/checkout@HEAD
- name: Setup R for build
uses: ./.github/actions/setup-r-for-build
- name: Build TinyTeX-0
run: |
sed -i 's|# finished base|cp $OLDPWD/install-tl-unx.tar.gz tools/; Rscript tools/clean-tlpdb.R; tar Jcf TinyTeX-0-linux-arm64.tar.xz -C ~ .TinyTeX|' tools/install-unx.sh
./tools/install-unx.sh
echo "$HOME/bin" >> $GITHUB_PATH
ls -lisah "$HOME/bin"
- name: Build TinyTeX-1
run: |
Rscript "tools/clean-tlpdb.R"
tar Jcf TinyTeX-1-linux-arm64.tar.xz -C ~ .TinyTeX
- name: Build TinyTeX
run: |
Rscript "tools/test-basic.R"
tar Jcf TinyTeX-linux-arm64.tar.xz -C ~ .TinyTeX
- name: Build TinyTeX-2
id: build-tinytex-2
env:
TEXLIVE_YEAR: ${{ needs.validate-ctan.outputs.texlive-year }}
run: sh tools/build-tinytex-2.sh
- name: Package TinyTeX-2
if: steps.build-tinytex-2.outputs.tinytex2-changed != 'false'
run: tar Jcf TinyTeX-2-linux-arm64.tar.xz -C ~ .TinyTeX
- run: ls -lisah
- name: Upload bundles
uses: ./.github/actions/upload-bundles
with:
draft-tag: ${{ needs.new-release.outputs.draft-tag }}
build-linux-musl:
needs: [validate-ctan, new-release]
name: Build Bundles For Linux (musl/Alpine)
runs-on: ubuntu-latest
permissions:
contents: read
container:
image: alpine:latest
options: --user root
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Install build dependencies
run: apk add --no-cache bash R R-dev perl wget xz tar curl git github-cli g++ pandoc cmake linux-headers
- name: Clean up any existing TinyTeX bundles
run: rm -f TinyTeX-*.* TinyTeX.*
- name: Clone repo
uses: actions/checkout@HEAD
- name: Install R packages
uses: yihui/actions/setup-r-dependencies@HEAD
with:
extra-packages: rmarkdown kableExtra bookdown .
- name: Build TinyTeX-0
run: |
sed -i 's|# finished base|cp $OLDPWD/install-tl-unx.tar.gz tools/; Rscript tools/clean-tlpdb.R; tar Jcf TinyTeX-0-linuxmusl-x86_64.tar.xz -C ~ .TinyTeX|' tools/install-unx.sh
./tools/install-unx.sh
echo "$HOME/bin" >> $GITHUB_PATH
ls -lisah "$HOME/bin"
- name: Build TinyTeX-1
run: |
Rscript "tools/clean-tlpdb.R"
tar Jcf TinyTeX-1-linuxmusl-x86_64.tar.xz -C ~ .TinyTeX
- name: Build TinyTeX
run: |
Rscript "tools/test-basic.R"
tar Jcf TinyTeX-linuxmusl-x86_64.tar.xz -C ~ .TinyTeX
- name: Build TinyTeX-2
id: build-tinytex-2
env:
TEXLIVE_YEAR: ${{ needs.validate-ctan.outputs.texlive-year }}
run: sh tools/build-tinytex-2.sh
- name: Package TinyTeX-2
if: steps.build-tinytex-2.outputs.tinytex2-changed != 'false'
run: tar Jcf TinyTeX-2-linuxmusl-x86_64.tar.xz -C ~ .TinyTeX
- run: ls -lisah
- name: Upload bundles
uses: ./.github/actions/upload-bundles
with:
draft-tag: ${{ needs.new-release.outputs.draft-tag }}
build-mac:
needs: [validate-ctan, new-release]
runs-on: macos-latest
name: Build Bundles For macOS
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Clone repo
uses: actions/checkout@HEAD
- name: Setup R for build
uses: ./.github/actions/setup-r-for-build
- name: Build TinyTeX-0
run: |
sed -i '' 's|# finished base|Rscript tools/clean-tlpdb.R; tar Jcf TinyTeX-0-darwin.tar.xz -C ~/Library TinyTeX|' tools/install-unx.sh
./tools/install-unx.sh
- name: Build TinyTeX-1
run: |
Rscript "tools/clean-tlpdb.R"
tar Jcf TinyTeX-1-darwin.tar.xz -C ~/Library TinyTeX
- name: Build TinyTeX
run: |
Rscript "tools/test-basic.R"
tar Jcf TinyTeX-darwin.tar.xz -C ~/Library TinyTeX
tar zcf TinyTeX.tgz -C ~/Library TinyTeX
- name: Build TinyTeX-2
id: build-tinytex-2
env:
TEXLIVE_YEAR: ${{ needs.validate-ctan.outputs.texlive-year }}
run: sh tools/build-tinytex-2.sh
- name: Package TinyTeX-2
if: steps.build-tinytex-2.outputs.tinytex2-changed != 'false'
run: tar Jcf TinyTeX-2-darwin.tar.xz -C ~/Library TinyTeX
- run: ls -lisah
- name: Upload bundles
uses: ./.github/actions/upload-bundles
with:
draft-tag: ${{ needs.new-release.outputs.draft-tag }}
deploy:
needs: [validate-ctan, new-release, build-windows, build-linux, build-linux-arm64, build-linux-musl, build-mac]
runs-on: ubuntu-latest
name: Publish new daily release
steps:
- name: Create release note
run: |
echo "This release contains the daily build of TinyTeX ($(date +'%A %B %d %Y %r %Z'))." > notes.md
echo "Please see https://github.com/rstudio/tinytex-releases for more info." >> notes.md
echo "" >> notes.md
echo "## TeX Live version" >> notes.md
echo "" >> notes.md
echo '```' >> notes.md
cat <<EOF >> notes.md
${{ needs.build-linux.outputs.tlmgr-version }}
EOF
echo '```' >> notes.md
echo "" >> notes.md
if [ "${{ needs.validate-ctan.outputs.texlive-year }}" != "unknown" ]; then
echo "Built from CTAN repository: \`$CTAN_REPO\` (TeX Live ${{ needs.validate-ctan.outputs.texlive-year }})" >> notes.md
else
echo "Built from CTAN repository: \`$CTAN_REPO\`" >> notes.md
fi
- name: Publish new release
run: |
echo "::group::Move tag to last commit on master"
sha=$(gh api repos/{owner}/{repo}/git/ref/heads/master --jq '.object.sha')
gh api repos/{owner}/{repo}/git/refs/tags/daily -f sha=$sha --template 'Tag {{.ref | color "blue"}} moved on commit sha {{.object.sha | color "blue"}}.'
echo -e "\n::endgroup::"
echo "::group::undraft new and delete current release"
old=$(gh release edit ${{needs.new-release.outputs.tag}} --draft=true | grep -o tag/[^/]*$ | cut -c 5-)
gh release edit ${{needs.new-release.outputs.draft-tag}} --draft=false --notes-file notes.md
gh release delete ${old} -y
echo -e "\n::endgroup::"
cleaning:
needs: [new-release, deploy]
if: ${{ failure() || cancelled() }}
runs-on: ubuntu-latest
name: Cleaning step in case of error
steps:
- name: Remove unused daily release
run: |
gh release delete ${{needs.new-release.outputs.draft-tag}} -y