name: Book on: pull_request: paths: - 'docs/book/**' push: paths: - 'docs/book/**' jobs: tests: name: Test code examples runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Install rust uses: actions-rs/toolchain@v1 with: toolchain: stable profile: minimal override: true - name: Test via skeptic uses: actions-rs/cargo@v1 with: command: test args: --manifest-path docs/book/tests/Cargo.toml deploy: name: Deploy book on gh-pages needs: [tests] if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Install mdBook uses: peaceiris/actions-mdbook@v1 - name: Render book run: | mdbook build -d gh-pages/master docs/book - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} keepFiles: true publish_dir: docs/book/gh-pages