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
|
2022-08-27 19:46:54 +08:00
|
|
|
runs-on: ubuntu-22.04
|
2021-07-07 11:09:42 +08:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@main
|
|
|
|
- name: Update rustup
|
|
|
|
run: rustup self update
|
|
|
|
- name: Install Rust
|
|
|
|
run: |
|
|
|
|
rustup set profile minimal
|
2023-12-17 21:13:56 +08:00
|
|
|
rustup toolchain install 1.74.1 -c rust-docs
|
|
|
|
rustup default 1.74.1
|
2024-03-10 21:00:07 +08:00
|
|
|
- name: Install mdbook & mdbook-typst-pdf
|
2021-07-07 11:09:42 +08:00
|
|
|
run: |
|
|
|
|
mkdir bin
|
2024-10-22 01:24:37 +08:00
|
|
|
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
|
|
|
|
curl -sSL https://github.com/KaiserY/mdbook-typst-pdf/releases/download/v0.5.1/mdbook-typst-pdf-x86_64-unknown-linux-musl.tar.xz | tar -xJ --directory=bin --strip-components 1
|
2022-02-19 17:08:39 +08:00
|
|
|
echo "$(pwd)/bin" >> ${GITHUB_PATH}
|
|
|
|
- name: Install font
|
|
|
|
run: |
|
2022-08-27 22:46:00 +08:00
|
|
|
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
|
2023-12-17 22:01:48 +08:00
|
|
|
sudo apt-get -y install msttcorefonts
|
|
|
|
mkdir fonts
|
|
|
|
mkdir -p ~/.local/share/fonts
|
2024-04-21 21:45:42 +08:00
|
|
|
curl -sL -o Noto_Sans.zip https://github.com/notofonts/latin-greek-cyrillic/releases/download/NotoSans-v2.013/NotoSans-v2.013.zip
|
2023-12-17 22:01:48 +08:00
|
|
|
unzip Noto_Sans.zip -d fonts/Noto_Sans
|
2024-04-21 21:45:42 +08:00
|
|
|
curl -sL -o Noto_Sans_SC.zip https://github.com/notofonts/noto-cjk/releases/download/Sans2.004/08_NotoSansCJKsc.zip
|
2023-12-17 22:01:48 +08:00
|
|
|
unzip Noto_Sans_SC.zip -d fonts/Noto_Sans_SC
|
2024-04-21 21:45:42 +08:00
|
|
|
curl -sL -o Noto_Sans_Mono.zip https://github.com/notofonts/latin-greek-cyrillic/releases/download/NotoSansMono-v2.014/NotoSansMono-v2.014.zip
|
2023-12-17 22:01:48 +08:00
|
|
|
unzip Noto_Sans_Mono.zip -d fonts/Noto_Sans_Mono
|
2024-04-21 21:58:08 +08:00
|
|
|
curl -sL -o Noto_Sans_KR.zip https://github.com/notofonts/noto-cjk/releases/download/Sans2.004/07_NotoSansCJKkr.zip
|
2023-12-17 22:01:48 +08:00
|
|
|
unzip Noto_Sans_KR.zip -d fonts/Noto_Sans_KR
|
2024-04-21 21:58:08 +08:00
|
|
|
curl -sL -o Noto_Sans_Thai.zip https://github.com/notofonts/thai/releases/download/NotoSansThai-v2.002/NotoSansThai-v2.002.zip
|
2023-12-17 22:01:48 +08:00
|
|
|
unzip Noto_Sans_Thai.zip -d fonts/Noto_Sans_Thai
|
2024-04-21 21:58:08 +08:00
|
|
|
curl -sL -o Noto_Sans_Arabic.zip https://github.com/notofonts/arabic/releases/download/NotoNaskhArabic-v2.018/NotoNaskhArabic-v2.018.zip
|
2023-12-17 22:01:48 +08:00
|
|
|
unzip Noto_Sans_Arabic.zip -d fonts/Noto_Sans_Arabic
|
2024-04-21 21:58:08 +08:00
|
|
|
curl -sL -o Noto_Sans_Devanagari.zip https://github.com/notofonts/devanagari/releases/download/NotoSansDevanagari-v2.004/NotoSansDevanagari-v2.004.zip
|
2024-04-21 22:13:27 +08:00
|
|
|
unzip -: Noto_Sans_Devanagari.zip -d fonts/Noto_Sans_Devanagari
|
2024-04-21 21:58:08 +08:00
|
|
|
curl -sL -o NotoColorEmoji.ttf https://github.com/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf
|
|
|
|
mv NotoColorEmoji.ttf fonts/NotoColorEmoji.ttf
|
2023-12-17 22:01:48 +08:00
|
|
|
curl -sL -o times_sans_serif.zip https://dl.dafont.com/dl/?f=times_sans_serif
|
|
|
|
unzip times_sans_serif.zip -d fonts/times_sans_serif
|
2024-04-21 22:09:43 +08:00
|
|
|
curl -sOL https://github.com/notofonts/hebrew/releases/download/NotoSansHebrew-v2.003/NotoSansHebrew-v2.003.zip
|
|
|
|
unzip -: NotoSansHebrew-v2.003.zip
|
|
|
|
mv -v NotoSansHebrew fonts/
|
2023-12-17 22:01:48 +08:00
|
|
|
mv fonts/* ~/.local/share/fonts/
|
|
|
|
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/
|
2023-12-17 21:13:56 +08:00
|
|
|
mv "book/typst-pdf/Rust 程序设计语言 简体中文版.pdf" book/
|
2022-02-19 17:47:59 +08:00
|
|
|
rm -r book/html/
|
2023-12-17 21:13:56 +08:00
|
|
|
rm -rf book/typst-pdf/
|
2021-08-08 19:37:30 +08:00
|
|
|
- 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
|