Generate PDF doc #67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate PDF doc | |
on: | |
push: | |
branches: | |
- pdf-doc | |
paths: | |
- '.github/workflows/pdf-doc.yml' | |
- 'docs/**' | |
schedule: | |
# minute (0-59) | |
# hour (0-23) | |
# day of the month (1-31) | |
# month (1-12) | |
# day of the week (0-6) | |
# nightly build at 23:50 UTC time every day | |
- cron: "50 23 * * *" | |
workflow_dispatch: | |
concurrency: | |
group: pdf-doc-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pdf-doc: | |
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.10"] | |
steps: | |
# refer to https://github.com/actions/checkout | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run docker | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: reitzig/texlive-full:latest | |
# image: ghcr.io/xu-cheng/texlive-full:latest | |
options: | | |
--volume ${{ github.workspace }}/:/workspace | |
shell: bash | |
run: | | |
uname -a | |
cat /etc/*release | |
id | |
pwd | |
ls -lh | |
cd /workspace | |
which latexmk | |
apk add --no-cache python3 py3-pip git make gcc zlib-dev libffi-dev openssl-dev musl-dev ghostscript curl | |
python3 --version | |
python3 -m venv abc | |
source ./abc/bin/activate | |
python3 -m ensurepip | |
python3 -m pip install -r ./docs/requirements.txt | |
cd docs | |
# make latex | |
make latexpdf | |
cd build/latex | |
#latexmk -interaction=nonstopmode -f -pdf -dvi- -ps- sherpa.tex || true | |
# latexmk -interaction=nonstopmode -f -pdf -dvi- -ps- sherpa.tex >/dev/null | |
find . -name "*.pdf" | |
ls -lh sherpa.pdf | |
cp -v sherpa.pdf /workspace/ | |
- name: View generated files | |
shell: bash | |
run: | | |
ls -lh sherpa.pdf | |
- name: Release sherpa.pdf | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file_glob: true | |
overwrite: true | |
file: ./sherpa.pdf | |
tag: doc | |
- name: Publish to huggingface | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
uses: nick-fields/retry@v3 | |
with: | |
max_attempts: 20 | |
timeout_seconds: 200 | |
shell: bash | |
command: | | |
git config --global user.email "csukuangfj@gmail.com" | |
git config --global user.name "Fangjun Kuang" | |
rm -rf huggingface | |
export GIT_LFS_SKIP_SMUDGE=1 | |
export GIT_CLONE_PROTECTION_ACTIVE=false | |
git clone https://huggingface.co/csukuangfj/sherpa-doc huggingface | |
cd huggingface | |
cp -v ../sherpa.pdf ./ | |
git status | |
git lfs track "*.pdf" | |
git add . | |
git commit -m "update doc" | |
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-doc main |