Update README.md #356
This file contains 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
# This is a basic workflow to help you get started with Actions | |
name: build | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- 'docs/docs.pdf' | |
- 'pdf/codebook.pdf' | |
- 'README.md' | |
- '.editorconfig' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
all: | |
name: build and commit | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check if not only codebook changed | |
id: if-not-only-codebook-changed | |
uses: tj-actions/changed-files@v39 | |
with: | |
files: '**' | |
files_ignore: | | |
'pdf/**' | |
'codes/**' | |
- name: Check if not only docs changed | |
id: if-not-only-docs-changed | |
uses: tj-actions/changed-files@v39 | |
with: | |
files: '**' | |
files_ignore: 'docs/**' | |
- name: Use Node.js 20.x | |
if: steps.if-not-only-codebook-changed.outputs.any_changed == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- name: update apt package list | |
run: sudo apt-get update | |
- name: Install codebook build dependencies | |
if: steps.if-not-only-docs-changed.outputs.any_changed == 'true' | |
run: sudo apt-get install -y cpp latexmk texlive-lang-chinese texlive-science texlive-xetex | |
- name: Install docs build dependencies | |
if: steps.if-not-only-codebook-changed.outputs.any_changed == 'true' | |
run: | | |
sudo apt-get install -y ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils | |
npm i -g md-to-pdf | |
- name: Build codebook | |
if: steps.if-not-only-docs-changed.outputs.any_changed == 'true' | |
working-directory: pdf | |
run: latexmk --xelatex --shell-escape codebook.tex | |
- name: Build docs | |
if: steps.if-not-only-codebook-changed.outputs.any_changed == 'true' | |
working-directory: docs | |
run: | | |
bash -c "printf -- \"---\\nscript:\\n - path: mathjax-config.js\\n - url: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js\\n---\\n\" | cat - Basic.md DataStructure.md FlowAndMatching.md Graph.md Math.md Geometry.md String.md Misc.md | md-to-pdf --launch-options '{ \"args\": [\"--no-sandbox\", \"--disable-setuid-sandbox\"] }' > docs.pdf" | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: auto build - ${{ github.sha }} |