fix(ci): add missing permissions and protoc dependencies (#9912) #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Book | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - book/** | |
| - katex-header.html | |
| - "**/*.rs" | |
| - "**/Cargo.toml" | |
| - "**/Cargo.lock" | |
| - .cargo/config.toml | |
| - "**/clippy.toml" | |
| - .github/workflows/book.yml | |
| # Ensures that only one workflow task will run at a time. Previous builds, if | |
| # already in process, will get cancelled. Only the latest commit will be allowed | |
| # to run, cancelling any workflows in between | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| build: | |
| name: Build Docs | |
| permissions: | |
| id-token: write | |
| statuses: write | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Setup mdBook | |
| uses: jontze/action-mdbook@6c0be56d14c4bf16861b00af61f50ff7400ce502 #v4.0.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| mdbook-version: ~0.4 | |
| use-linkcheck: true | |
| use-mermaid: true | |
| - name: Install last version of Protoc | |
| uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b #v3.0.0 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions-rust-lang/setup-rust-toolchain@ab6845274e2ff01cd4462007e1a9d9df1ab49f42 #v1.14.0 | |
| with: | |
| toolchain: nightly | |
| cache-on-failure: true | |
| - name: Build Zebra book | |
| run: | | |
| mdbook build book --dest-dir "$(pwd)"/target/docs | |
| env: | |
| # The -A and -W settings must be the same as the `rustdocflags` in: | |
| # https://github.com/ZcashFoundation/zebra/blob/main/.cargo/config.toml#L87 | |
| RUSTDOCFLAGS: --html-in-header katex-header.html -A rustdoc::private_intra_doc_links -D warnings | |
| - name: Build internal docs | |
| run: | | |
| cargo doc --no-deps --workspace --all-features --document-private-items --target-dir "$(pwd)"/target/internal | |
| # Copy internal docs to docs directory | |
| mkdir -p target/docs/internal | |
| cp -r target/internal/doc/* target/docs/internal/ | |
| env: | |
| # Keep in sync with ./lint.yml:jobs.docs | |
| # The -A and -W settings must be the same as the `rustdocflags` in: | |
| # https://github.com/ZcashFoundation/zebra/blob/main/.cargo/config.toml#L87 | |
| RUSTDOCFLAGS: --html-in-header katex-header.html -D warnings -A rustdoc::private_intra_doc_links --cfg docsrs --show-type-layout --generate-link-to-definition --enable-index-page -Zunstable-options | |
| - name: Setup Pages | |
| uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b #v5.0.0 | |
| - name: Upload site | |
| uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b #v4.0.0 | |
| with: | |
| path: ./target/docs | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| # Only deploy if a push to main | |
| # TODO: Uncomment this before merging | |
| # if: github.ref_name == 'main' && github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| timeout-minutes: 30 | |
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e #v4.0.5 | |
| book-success: | |
| name: book success | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: | |
| - build | |
| - deploy | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Decide whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe #v1.2.2 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |