name: Deploy Documentation
on:
push:
branches: [main, master]
paths:
- 'book/**'
- 'docs/**'
- '.github/workflows/deploy-docs.yml'
pull_request:
branches: [main, master]
paths:
- 'book/**'
- 'docs/**'
- '.github/workflows/deploy-docs.yml'
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: 'latest'
- name: Build book
run: mdbook build book
- name: Check links
uses: lycheeverse/lychee-action@v2
with:
args: --offline --root-dir book/book book/book
- name: Deploy to GitHub Pages
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/book