Skip to content

Commit

Permalink
refactor(download): use manual input to download texlive release
Browse files Browse the repository at this point in the history
  • Loading branch information
zydou committed Jun 21, 2024
1 parent 0ba6373 commit cb03698
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 106 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/download-texlive-historic.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/download-texlive-latest.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/download-texlive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: Download Release

on:
workflow_dispatch:
inputs:
year:
required: true
description: texlive year
default: 2024
type: number
latest:
required: true
description: This is latest release
default: true
type: boolean

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

permissions:
contents: write

jobs:
historic:
name: Download ${{ inputs.year }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main

- name: Generate release notes
run: |
echo 'This is texlive-${{inputs.year}} release' > RELEASE.md
echo 'Please download all `texlive_${{inputs.year}}_partXX` files first.' >> RELEASE.md
echo 'Then run `cat texlive_${{inputs.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 latest
if: inputs.latest
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: Download historic
if: inputs.latest == 0
run: |-
mkdir -p texlive
rsync -axz --delete "rsync://mirrors.tuna.tsinghua.edu.cn/tex-historic-archive/systems/texlive/${{inputs.year}}/tlnet-final/" texlive
tar -cf archive.tar texlive
rm -rf texlive
split -d -n 4 archive.tar "texlive_${{inputs.year}}_part"
rm -f archive.tar
ls -lh
- name: Upload latest release
if: inputs.latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
gh release create "texlive-${{inputs.year}}" --latest --title "texlive-${{inputs.year}}" --notes-file RELEASE.md -R ${{ github.repository }} || true
gh release edit "texlive-${{inputs.year}}" --latest --title "texlive-${{inputs.year}}" --notes-file RELEASE.md -R ${{ github.repository }} || true
gh release upload --clobber "texlive-${{inputs.year}}" ./texlive_${{inputs.year}}_part* -R ${{ github.repository }}
- name: Upload historic release
if: inputs.latest == 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
gh release create "texlive-${{inputs.year}}" --latest=false --title "texlive-${{inputs.year}}" --notes-file RELEASE.md -R ${{ github.repository }} || true
gh release edit "texlive-${{inputs.year}}" --title "texlive-${{inputs.year}}" --notes-file RELEASE.md -R ${{ github.repository }} || true
gh release upload --clobber "texlive-${{inputs.year}}" ./texlive_${{inputs.year}}_part* -R ${{ github.repository }}

0 comments on commit cb03698

Please sign in to comment.