Skip to content

Commit fd9bc66

Browse files
t push
feat: 完善构建脚本
1 parent e916581 commit fd9bc66

2 files changed

Lines changed: 56 additions & 50 deletions

File tree

.github/workflows/epub.yml

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,62 @@
11
name: epub
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- epub
8-
workflow_dispatch:
4+
push:
5+
branches:
6+
- epub
7+
workflow_dispatch:
98

109
permissions:
11-
contents: read
10+
contents: read
1211

1312
jobs:
14-
build:
15-
name: Build EPUB and PDF
16-
runs-on: ubuntu-latest
17-
steps:
18-
- uses: actions/checkout@v4
19-
20-
- name: Install Tectonic
21-
uses: wtfjoke/setup-tectonic@v1
22-
with:
23-
github-token: ${{ secrets.GITHUB_TOKEN }}
24-
25-
- name: Install Pandoc and Fonts
26-
run: |
27-
sudo apt-get update
28-
sudo apt-get install -y pandoc fonts-noto-cjk
29-
30-
- name: Install mdbook
31-
uses: peaceiris/actions-mdbook@v1
32-
with:
33-
mdbook-version: "latest"
34-
35-
- name: Install mdbook-pandoc
36-
run: |
37-
cargo install mdbook-pandoc
38-
39-
- name: Build Book
40-
run: mdbook build
41-
42-
- name: List Output Directory
43-
if: always()
44-
run: find book -maxdepth 4
45-
46-
- name: Upload EPUB
47-
uses: actions/upload-artifact@v4
48-
with:
49-
name: rust-course-epub
50-
path: book/pandoc/epub/rust-course.epub
51-
52-
- name: Upload PDF
53-
uses: actions/upload-artifact@v4
54-
with:
55-
name: rust-course-pdf
56-
path: book/pandoc/pdf/rust-course.pdf
13+
build:
14+
name: Build EPUB and PDF
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install mdbook
20+
uses: peaceiris/actions-mdbook@v2
21+
with:
22+
mdbook-version: "latest"
23+
24+
- name: Install Pandoc
25+
uses: pandoc/actions/setup@v3
26+
with:
27+
version: "3.1"
28+
29+
- name: Install Tectonic
30+
uses: wtfjoke/setup-tectonic@v1
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Install fonts
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y fonts-noto-cjk fonts-noto-cjk-extra
38+
39+
- name: Install mdbook-pandoc
40+
run: |
41+
cargo install mdbook-pandoc
42+
43+
- name: Build Book
44+
run: mdbook build
45+
46+
- name: List Output Directory
47+
if: always()
48+
run: find book -maxdepth 4
49+
50+
- name: Upload EPUB
51+
if: success()
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: rust-course-epub
55+
path: book/pandoc/epub/rust-course.epub
56+
57+
- name: Upload PDF
58+
if: success()
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: rust-course-pdf
62+
path: book/pandoc/pdf/rust-course.pdf

book.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ disabled = false
2929
output-file = "rust-course.pdf"
3030
pdf-engine = "tectonic"
3131
to = "pdf"
32-
variables = { mainfont = "Noto Sans CJK SC", sansfont = "Noto Sans CJK SC" }
32+
variables = { mainfont = "Noto Sans CJK SC", sansfont = "Noto Sans CJK SC", CJKmainfont = "Noto Sans CJK SC" }
3333

3434
[output.pandoc.profile.epub]
3535
output-file = "rust-course.epub"

0 commit comments

Comments
 (0)