Skip to content

Build and Release LaTeX document #190

Build and Release LaTeX document

Build and Release LaTeX document #190

Workflow file for this run

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: OI-wiki/[email protected]
with:
latexmk_use_xelatex: true
latexmk_shell_escape: true
args: "-pdf -file-line-error -halt-on-error -interaction=nonstopmode -8bit"
extra_system_packages: |
unzip
wget
curl
coreutils
nodejs
npm
imagemagick
libwebp
librsvg
git
python3
py3-pygments
inkscape
libxml2
openssh
pre_compile: |
umask 0 && npm config set cache /tmp/.npm
wget -q -O notosans.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSans-hinted.zip"
wget -q -O notoserif.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSerif-hinted.zip"
wget -q -O notoserifcjk.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSerifCJKsc-hinted.zip"
wget -q -O notosanscjk.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSansCJKsc-hinted.zip"
wget -q "https://mirror.math.princeton.edu/pub/CTAN/fonts/cm-unicode.zip"
git clone https://github.com/googlefonts/RobotoMono
unzip -q notosans.zip -d notosans
unzip -q notoserif.zip -d notoserif
unzip -q notosanscjk.zip -d notosanscjk
unzip -q notoserifcjk.zip -d notoserifcjk
unzip ./cm-unicode.zip
cp -r notosans notoserif notosanscjk notoserifcjk cm-unicode/fonts/otf/* RobotoMono/fonts/ttf/* /usr/share/fonts
fc-cache
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 "::set-output name=tag_name::$tag_name"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.tag_name }}
release_name: Release ${{ steps.create_tag.outputs.tag_name }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./oi-wiki-export/oi-wiki-export.pdf
asset_name: OI-wiki.pdf
asset_content_type: application/pdf