diff --git a/.github/workflows/epub.yml b/.github/workflows/epub.yml index b3edf9ac..8b9b7036 100644 --- a/.github/workflows/epub.yml +++ b/.github/workflows/epub.yml @@ -1,56 +1,62 @@ name: epub on: - push: - branches: - - main - - epub - workflow_dispatch: + push: + branches: + - epub + workflow_dispatch: permissions: - contents: read + contents: read jobs: - build: - name: Build EPUB and PDF - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Tectonic - uses: wtfjoke/setup-tectonic@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install Pandoc and Fonts - run: | - sudo apt-get update - sudo apt-get install -y pandoc fonts-noto-cjk - - - name: Install mdbook - uses: peaceiris/actions-mdbook@v1 - with: - mdbook-version: "latest" - - - name: Install mdbook-pandoc - run: | - cargo install mdbook-pandoc - - - name: Build Book - run: mdbook build - - - name: List Output Directory - if: always() - run: find book -maxdepth 4 - - - name: Upload EPUB - uses: actions/upload-artifact@v4 - with: - name: rust-course-epub - path: book/pandoc/epub/rust-course.epub - - - name: Upload PDF - uses: actions/upload-artifact@v4 - with: - name: rust-course-pdf - path: book/pandoc/pdf/rust-course.pdf + build: + name: Build EPUB and PDF + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install mdbook + uses: peaceiris/actions-mdbook@v2 + with: + mdbook-version: "latest" + + - name: Install Pandoc + uses: pandoc/actions/setup@v3 + with: + version: "3.1" + + - name: Install Tectonic + uses: wtfjoke/setup-tectonic@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install fonts + run: | + sudo apt-get update + sudo apt-get install -y fonts-noto-cjk fonts-noto-cjk-extra + + - name: Install mdbook-pandoc + run: | + cargo install mdbook-pandoc + + - name: Build Book + run: mdbook build + + - name: List Output Directory + if: always() + run: find book -maxdepth 4 + + - name: Upload EPUB + if: success() + uses: actions/upload-artifact@v4 + with: + name: rust-course-epub + path: book/pandoc/epub/rust-course.epub + + - name: Upload PDF + if: success() + uses: actions/upload-artifact@v4 + with: + name: rust-course-pdf + path: book/pandoc/pdf/rust-course.pdf diff --git a/book.toml b/book.toml index 6a7d433e..cc8720f7 100644 --- a/book.toml +++ b/book.toml @@ -29,7 +29,7 @@ disabled = false output-file = "rust-course.pdf" pdf-engine = "tectonic" to = "pdf" -variables = { mainfont = "Noto Sans CJK SC", sansfont = "Noto Sans CJK SC" } +variables = { mainfont = "Noto Sans CJK SC", sansfont = "Noto Sans CJK SC", CJKmainfont = "Noto Sans CJK SC" } [output.pandoc.profile.epub] output-file = "rust-course.epub"