Build and Release LaTeX document #279
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: Build and Release LaTeX document | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: release tag name | |
| required: false | |
| schedule: | |
| - cron: "0 0 * * 0" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build the LaTeX document | |
| uses: xu-cheng/latex-action@v3 | |
| with: | |
| latexmk_use_xelatex: true | |
| latexmk_shell_escape: true | |
| args: "-pdf -file-line-error -halt-on-error -interaction=batchmode -8bit" | |
| extra_system_packages: | | |
| unzip | |
| wget | |
| curl | |
| coreutils | |
| nodejs | |
| npm | |
| imagemagick | |
| libwebp | |
| librsvg | |
| git | |
| python3 | |
| py3-pygments | |
| libxml2 | |
| openssh | |
| sqlite-dev | |
| font-noto | |
| font-noto-cjk | |
| pre_compile: | | |
| umask 0 && npm config set cache /tmp/.npm | |
| curl -L -o cm-unicode.zip "https://mirrors.ctan.org/fonts/cm-unicode.zip" | |
| git clone https://github.com/googlefonts/RobotoMono | |
| unzip ./cm-unicode.zip | |
| cp -r cm-unicode/fonts/otf/* RobotoMono/fonts/ttf/* /usr/share/fonts | |
| fc-cache | |
| cd remark-snippet | |
| npm i | |
| cd .. | |
| cd remark-latex | |
| npm i | |
| cd .. | |
| cd oi-wiki-export | |
| npm i | |
| git clone https://github.com/OI-wiki/OI-wiki.git --depth=1 --single-branch -b master | |
| python3 increase-mem-limit.py | |
| fmtutil-sys --all | |
| node index.js ./OI-wiki | |
| root_file: | | |
| oi-wiki-export.tex | |
| - name: Create Tag | |
| id: create_tag | |
| run: | | |
| tag_name=$(TZ="Asia/Shanghai" date +"v%Y%m%d_%H%M") | |
| if [[ -n "${{github.event.inputs.tag_name}}" ]]; then tag_name=${{github.event.inputs.tag_name}}; fi | |
| git tag $tag_name | |
| git push --tags | |
| echo "tag_name=$tag_name" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| shell: bash | |
| run: | | |
| set -x | |
| mv ./oi-wiki-export/oi-wiki-export.pdf ./OI-wiki.pdf | |
| gh release create "${{ steps.create_tag.outputs.tag_name }}" ./OI-wiki.pdf | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| RELEASE_NAME: "Release ${{ steps.create_tag.outputs.tag_name }}" |