Skip to content

Commit 8ddaec5

Browse files
committed
Merging the preview into pages.yml given preview currently only has the pages preview logic
Signed-off-by: Shengliang Xu <shengliangx@nvidia.com>
1 parent 61cf5c8 commit 8ddaec5

2 files changed

Lines changed: 22 additions & 31 deletions

File tree

.github/workflows/pages.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Docs
22

33
on:
44
pull_request:
5+
types: [opened, synchronize, reopened, closed]
56
branches: [main, release/*, feature/*]
67
push:
78
branches: [main]
@@ -14,9 +15,9 @@ concurrency:
1415
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
1516
cancel-in-progress: true
1617

17-
# contents: write required to push to gh-pages branch
1818
permissions:
19-
contents: write
19+
contents: write # push to gh-pages branch
20+
pull-requests: write # post/update preview URL comment on PRs
2021

2122
jobs:
2223
build-docs:
@@ -34,6 +35,24 @@ jobs:
3435
name: docs-html
3536
path: docs/build/html
3637

38+
deploy-preview:
39+
if: github.event_name == 'pull_request'
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 30
42+
# Per-PR concurrency without cancel-in-progress so 'closed' cleanup always runs
43+
concurrency:
44+
group: pr-preview-${{ github.event.pull_request.number }}
45+
steps:
46+
- uses: actions/checkout@v6
47+
- uses: ./.github/actions/ubuntu-setup
48+
- name: Build docs
49+
if: github.event.action != 'closed'
50+
run: pip install tox && tox -e build-docs
51+
- name: Deploy / remove PR preview
52+
uses: rossjrw/pr-preview-action@v1
53+
with:
54+
source-dir: docs/build/html
55+
3756
deploy-gh-pages:
3857
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
3958
needs: build-docs
@@ -49,5 +68,5 @@ jobs:
4968
uses: JamesIves/github-pages-deploy-action@v4
5069
with:
5170
folder: docs/build/html
52-
# Preserve PR preview subdirectories deployed by pr-preview.yml
71+
# Preserve PR preview subdirectories deployed by the deploy-preview job
5372
clean-exclude: pr-preview

.github/workflows/pr-preview.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)