maplibre-rs/.github/workflows/build-deploy-docs.yml
2022-10-23 12:16:00 +02:00

70 lines
1.7 KiB
YAML

name: Build documentation
on:
workflow_call:
inputs:
deploy:
required: true
type: boolean
jobs:
build-docs:
name: Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Setup binstall
uses: ./.github/actions/setup-binstall
- name: Install just
shell: bash
run: cargo binstall just
- name: Install toolchain
shell: bash
run: just stable-toolchain
- uses: Swatinem/rust-cache@v2
- name: Install mdbook
shell: bash
run: cargo binstall mdbook
- name: Install Dependencies
shell: bash
run: sudo apt-get install -y libwayland-dev libxkbcommon-dev # Required for winit
- name: Build
working-directory: docs
shell: bash
run: mdbook build
- name: API Documentation
shell: bash
run: cargo doc -p maplibre --no-deps --lib --document-private-items
- uses: actions/upload-artifact@v3
with:
name: api-docs
path: target/doc/
- uses: actions/upload-artifact@v3
with:
name: book
path: docs/book/
deploy-docs:
needs: build-docs
if: inputs.deploy
name: Deploy
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Download api-docs
uses: actions/download-artifact@v3
with:
name: api-docs
path: artifacts/api
- name: Download book
uses: actions/download-artifact@v3
with:
name: book
path: artifacts/book
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.3
with:
branch: gh-pages
folder: artifacts
target-folder: docs