Skip to content

Commit

Permalink
feat: publish texlive archive to github release
Browse files Browse the repository at this point in the history
Using `rsync` to download CTAN repo is slow and does not support high concurrency
So, we download it and use `tar` to compress it into a single file.
Because GitHub Release has a 2GB file size limit, we split it into 4 chunks.
  • Loading branch information
zydou committed Aug 18, 2023
1 parent 1237b5d commit 1bee9ca
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/download-texlive-historic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Download Historic

on:
workflow_dispatch:
push:
paths:
- .github/workflows/download-texlive-historic.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
historic:
strategy:
fail-fast: false
max-parallel: 2
matrix:
year: [2018, 2019, 2020, 2021, 2022]
name: Download ${{ matrix.year }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main

- name: Generate release notes
run: |
echo 'This is texlive-${{matrix.year}} release' > RELEASE.md
echo 'Please download all `texlive_${{matrix.year}}_part_X` files first.' >> RELEASE.md
echo 'Then run `cat texlive_${{matrix.year}}_part_* > texlive.tar` to get the final tar file.' >> RELEASE.md
echo 'Finally, run `tar -xf texlive.tar` to extract the files.' >> RELEASE.md
cat RELEASE.md
- name: Download
run: |-
mkdir -p texlive
rsync -axz --delete "rsync://mirrors.tuna.tsinghua.edu.cn/tex-historic-archive/systems/texlive/${{matrix.year}}/tlnet-final/" texlive
tar -cf archive.tar texlive
rm -rf texlive
split -d -n 4 archive.tar "texlive_${{matrix.year}}_part"
rm -f archive.tar
ls -lh
- name: Upload to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
gh release delete "texlive-${{matrix.year}}" --cleanup-tag --yes || true
gh release create "texlive-${{matrix.year}}" --title "texlive-${{matrix.year}}" --notes-file RELEASE.md ./texlive_${{matrix.year}}_part*
54 changes: 54 additions & 0 deletions .github/workflows/download-texlive-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Download Latest

on:
workflow_dispatch:
schedule:
- cron: 0 7 1 * *
push:
paths:
- .github/workflows/download-texlive-latest.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
latest:
strategy:
fail-fast: false
max-parallel: 1
matrix:
year: [2023]
name: Download ${{ matrix.year }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main

- name: Generate release notes
run: |
echo 'This is texlive-${{matrix.year}} release' > RELEASE.md
echo 'Please download all `texlive_${{matrix.year}}_part_X` files first.' >> RELEASE.md
echo 'Then run `cat texlive_${{matrix.year}}_part_* > texlive.tar` to get the final tar file.' >> RELEASE.md
echo 'Finally, run `tar -xf texlive.tar` to extract the files.' >> RELEASE.md
cat RELEASE.md
- name: Download
run: |-
mkdir -p texlive
rsync -axz --delete "rsync://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet/" texlive
tar -cf archive.tar texlive
rm -rf texlive
split -d -n 4 archive.tar "texlive_${{matrix.year}}_part"
rm -f archive.tar
ls -lh
- name: Upload to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
gh release delete "texlive-${{matrix.year}}" --cleanup-tag --yes || true
gh release create "texlive-${{matrix.year}}" --title "texlive-${{matrix.year}}" --notes-file RELEASE.md --latest ./texlive_${{matrix.year}}_part*

0 comments on commit 1bee9ca

Please sign in to comment.