You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-07-04 21:58:46 +02:00
Render book as PDF in publish.yml
workflow (#1572)
Renders the book as a PDF and includes it in the published HTML bundle as `comprehensive-rust.pdf`. Closes #1543
This commit is contained in:
6
.github/workflows/build.sh
vendored
6
.github/workflows/build.sh
vendored
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Usage: build.sh <book-lang> <dest-dir>
|
||||
@ -29,9 +29,13 @@ else
|
||||
export MDBOOK_BOOK__LANGUAGE=$book_lang
|
||||
export MDBOOK_OUTPUT__HTML__SITE_URL=/comprehensive-rust/$book_lang/
|
||||
export MDBOOK_OUTPUT__HTML__REDIRECT='{}'
|
||||
|
||||
# Include language-specific Pandoc configuration
|
||||
[ -f "pandoc/$book_lang.yaml" ] && export MDBOOK_OUTPUT__PANDOC__PROFILE__PDF__DEFAULTS="pandoc/$book_lang.yaml"
|
||||
fi
|
||||
|
||||
mdbook build -d "$dest_dir"
|
||||
[ -f "$dest_dir/pandoc/pdf/comprehensive-rust.pdf" ] && mv "$dest_dir/pandoc/pdf/comprehensive-rust.pdf" "$dest_dir/html/"
|
||||
(cd "$dest_dir/exerciser" && zip --recurse-paths ../html/comprehensive-rust-exercises.zip comprehensive-rust-exercises/)
|
||||
|
||||
echo "::endgroup::"
|
||||
|
7
.github/workflows/publish.yml
vendored
7
.github/workflows/publish.yml
vendored
@ -39,6 +39,13 @@ jobs:
|
||||
- name: Install mdbook
|
||||
uses: ./.github/workflows/install-mdbook
|
||||
|
||||
- name: Install mdbook-pandoc and related dependencies
|
||||
run: |
|
||||
cargo install mdbook-pandoc --locked --version 0.4.0
|
||||
sudo apt-get install -y texlive texlive-luatex texlive-lang-cjk librsvg2-bin fonts-noto
|
||||
curl -LsSf https://github.com/jgm/pandoc/releases/download/3.1.11/pandoc-3.1.11-linux-amd64.tar.gz | tar zxf -
|
||||
echo "$PWD/pandoc-3.1.11/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build course in English
|
||||
run: .github/workflows/build.sh en book
|
||||
|
||||
|
Reference in New Issue
Block a user