name: docs-mdbook on: push: branches: - main pull_request: workflow_dispatch: permissions: contents: read concurrency: group: mdbook-${{ github.ref }} cancel-in-progress: true jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup mdBook uses: peaceiris/actions-mdbook@v2 with: mdbook-version: latest - name: Build book run: mdbook build docs/book - name: Upload book artifact uses: actions/upload-artifact@v4 with: name: mdbook-site path: ./book if-no-files-found: error deploy: if: github.event_name == 'push' && github.ref == 'refs/heads/main' needs: build permissions: contents: write runs-on: ubuntu-latest steps: - name: Download book artifact uses: actions/download-artifact@v4 with: name: mdbook-site path: ./book - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./book