name: Docs Preview
on:
pull_request:
workflow_dispatch:
inputs:
pr_number:
required: true
type: string
concurrency:
group: ci-docs-preview
env:
IROH_FORCE_STAGING_RELAYS: "1"
permissions:
contents: read
jobs:
preview_docs:
permissions:
contents: write pull-requests: write timeout-minutes: 30
name: Docs preview
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' ) && !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
SCCACHE_CACHE_SIZE: "50G"
PREVIEW_PATH: pr/${{ github.event.pull_request.number || inputs.pr_number }}/docs
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 with:
toolchain: nightly-2024-11-30
- name: Install sccache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba
- name: Generate Docs
run: cargo doc --locked --workspace --all-features --no-deps
env:
RUSTDOCFLAGS: --cfg iroh_docsrs
- name: Deploy Docs to Preview Branch
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc/
destination_dir: ${{ env.PREVIEW_PATH }}
publish_branch: generated-docs-preview
- name: Find Docs Comment
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad id: fc
with:
issue-number: ${{ github.event.pull_request.number || inputs.pr_number }}
comment-author: "github-actions[bot]"
body-includes: Documentation for this PR has been generated
- name: Get current timestamp
id: get_timestamp
run: echo "TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_ENV"
- name: Create or Update Docs Comment
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 with:
issue-number: ${{ github.event.pull_request.number || inputs.pr_number }}
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
Documentation for this PR has been generated and is available at: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.PREVIEW_PATH }}/n0_error/
Last updated: ${{ env.TIMESTAMP }}
edit-mode: replace