1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-16 23:08:36 +02:00
comprehensive-rust/.github/workflows/publish.yml
Max Heller 9ed01cca77
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
2024-01-15 23:02:05 +01:00

70 lines
1.8 KiB
YAML

name: Publish
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: pages
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# Update the language picker in index.hbs to link new languages.
LANGUAGES: bn da de es fa fr it ja ko pt-BR zh-CN zh-TW
jobs:
publish:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # We need the full history for build.sh below.
- name: Setup Rust cache
uses: ./.github/workflows/setup-rust-cache
- 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
- name: Build all translations
run: |
for po_lang in ${{ env.LANGUAGES }}; do
.github/workflows/build.sh $po_lang book/$po_lang
mv book/$po_lang/html book/html/$po_lang
done
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: book/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4