|
| 1 | +name: Docs Preview |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +jobs: |
| 7 | + preview_docs: |
| 8 | + timeout-minutes: 30 |
| 9 | + name: Docs preview |
| 10 | + if: "github.event_name == 'pull_request'" |
| 11 | + runs-on: ubuntu-latest |
| 12 | + env: |
| 13 | + RUSTC_WRAPPER: "sccache" |
| 14 | + SCCACHE_GHA_ENABLED: "on" |
| 15 | + SCCACHE_CACHE_SIZE: "50G" |
| 16 | + PREVIEW_PATH: pr/${{ github.event.pull_request.number }}/docs |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - uses: dtolnay/rust-toolchain@master |
| 21 | + with: |
| 22 | + toolchain: nightly-2024-05-02 |
| 23 | + - name: Install sccache |
| 24 | + uses: mozilla-actions/[email protected] |
| 25 | + |
| 26 | + - name: Generate Docs |
| 27 | + run: cargo doc --workspace --all-features --no-deps |
| 28 | + env: |
| 29 | + RUSTDOCFLAGS: --cfg docsrs |
| 30 | + |
| 31 | + - name: Deploy Docs to Preview Branch |
| 32 | + uses: peaceiris/actions-gh-pages@v4 |
| 33 | + with: |
| 34 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + publish_dir: ./target/doc/ |
| 36 | + destination_dir: ${{ env.PREVIEW_PATH }} |
| 37 | + publish_branch: generated-docs-preview |
| 38 | + |
| 39 | + - name: Find Docs Comment |
| 40 | + uses: peter-evans/find-comment@v3 |
| 41 | + id: fc |
| 42 | + with: |
| 43 | + issue-number: ${{ github.event.pull_request.number }} |
| 44 | + comment-author: 'github-actions[bot]' |
| 45 | + body-includes: Documentation for this PR has been generated |
| 46 | + |
| 47 | + - name: Create or Update Docs Comment |
| 48 | + uses: peter-evans/create-or-update-comment@v4 |
| 49 | + with: |
| 50 | + issue-number: ${{ github.event.pull_request.number }} |
| 51 | + comment-id: ${{ steps.fc.outputs.comment-id }} |
| 52 | + body: | |
| 53 | + Documentation for this PR has been generated and is available at: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.PREVIEW_PATH }}/iroh/ |
| 54 | + |
| 55 | + Last updated: ${{ github.event.pull_request.updated_at }} |
| 56 | + edit-mode: replace |
0 commit comments