trpl-zh-cn/.github/workflows/main.yml

80 lines
3.2 KiB
YAML
Raw Normal View History

2021-07-07 11:09:42 +08:00
name: CI
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Update rustup
run: rustup self update
- name: Install Rust
run: |
rustup set profile minimal
2022-08-27 19:39:39 +08:00
rustup toolchain install 1.62 -c rust-docs
rustup default 1.62
2021-07-07 11:09:42 +08:00
- name: Install mdbook
run: |
mkdir bin
2022-08-27 19:39:39 +08:00
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
2021-07-07 11:09:42 +08:00
echo "$(pwd)/bin" >> ${GITHUB_PATH}
2022-02-19 17:08:39 +08:00
- name: Install mdbook-latex-pdf
run: |
2022-08-27 19:39:39 +08:00
curl -sL -o bin/mdbook-latex-pdf https://github.com/KaiserY/mdbook-latex-pdf/releases/download/0.1.1/mdbook-latex-pdf-x86_64-unknown-linux-gnu
2022-02-19 17:08:39 +08:00
chmod +x bin/mdbook-latex-pdf
echo "$(pwd)/bin" >> ${GITHUB_PATH}
2022-02-19 17:20:46 +08:00
pip install --upgrade --force-reinstall Pygments
2022-02-19 17:08:39 +08:00
- name: Install font
run: |
mkdir fonts
mkdir -p ~/.local/share/fonts
curl -sL -o Noto_Sans.zip https://fonts.google.com/download?family=Noto%20Sans
unzip Noto_Sans.zip -d fonts/Noto_Sans
curl -sL -o Noto_Sans_SC.zip https://fonts.google.com/download?family=Noto%20Sans%20SC
unzip Noto_Sans_SC.zip -d fonts/Noto_Sans_SC
curl -sL -o Noto_Sans_Mono.zip https://fonts.google.com/download?family=Noto%20Sans%20Mono
unzip Noto_Sans_Mono.zip -d fonts/Noto_Sans_Mono
curl -sL -o Noto_Sans_KR.zip https://fonts.google.com/download?family=Noto%20Sans%20KR
unzip Noto_Sans_KR.zip -d fonts/Noto_Sans_KR
curl -sL -o Noto_Sans_Thai.zip https://fonts.google.com/download?family=Noto%20Sans%20Thai
unzip Noto_Sans_Thai.zip -d fonts/Noto_Sans_Thai
curl -sL -o Noto_Sans_Arabic.zip https://fonts.google.com/download?family=Noto%20Sans%20Arabic
unzip Noto_Sans_Arabic.zip -d fonts/Noto_Sans_Arabic
curl -sL -o Noto_Sans_Hebrew.zip https://fonts.google.com/download?family=Noto%20Sans%20Hebrew
unzip Noto_Sans_Hebrew.zip -d fonts/Noto_Sans_Hebrew
curl -sL -o Noto_Sans_Devanagari.zip https://fonts.google.com/download?family=Noto%20Sans%20Devanagari
unzip Noto_Sans_Devanagari.zip -d fonts/Noto_Sans_Devanagari
2022-08-27 19:39:39 +08:00
curl -sL -o Noto_Emoji.zip https://fonts.google.com/download?family=Noto%20Emoji
unzip Noto_Emoji.zip -d fonts/Noto_Emoji
2022-02-19 17:15:04 +08:00
mv fonts/* ~/.local/share/fonts/
2022-02-19 17:08:39 +08:00
fc-cache -rv
2021-07-07 11:09:42 +08:00
- name: Report versions
run: |
rustup --version
rustc -Vv
mdbook --version
- name: Run mdBook Build
2022-02-19 17:40:30 +08:00
run: |
mdbook build
2022-02-19 17:55:04 +08:00
mv book/html/* book/
mv "book/latex-pdf/Rust 程序设计语言 简体中文版.pdf" book/
2022-02-19 17:47:59 +08:00
rm -r book/html/
rm -rf book/latex-pdf/
- name: Deploy gh-pages
if: ${{ github.ref == 'refs/heads/main' }}
2021-07-07 11:09:42 +08:00
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book
force_orphan: true
2022-02-06 16:46:31 +08:00
enable_jekyll: true