forked from NVIDIA/Model-Optimizer
-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (89 loc) · 2.78 KB
/
pages.yml
File metadata and controls
97 lines (89 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Docs
on:
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [main, release/*, feature/*]
push:
branches: [main]
schedule:
- cron: "0 0 * * *" # Nightly
workflow_dispatch:
# On-demand
concurrency:
# Cancel previous runs if new commit is pushed
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: write # push to gh-pages branch
pull-requests: write # post/update preview URL comment on PRs
jobs:
build-docs:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ubuntu-setup
- name: Build docs
run: pip install nox uv && nox -s docs
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/build/html
retention-days: 1
changes:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs:
- 'docs/**'
- 'modelopt/**'
- '.github/workflows/pages.yml'
deploy-preview:
if: |
always() &&
github.event_name == 'pull_request' &&
(github.event.action == 'closed' || needs.changes.outputs.docs == 'true')
needs: [build-docs, changes]
runs-on: ubuntu-latest
timeout-minutes: 10
# Per-PR concurrency without cancel-in-progress so 'closed' cleanup always runs
concurrency:
group: pr-preview-${{ github.event.pull_request.number }}
steps:
- uses: actions/checkout@v6
- name: Download docs artifact
if: github.event.action != 'closed'
uses: actions/download-artifact@v4
with:
name: docs-html
path: docs/build/html
- name: Deploy / remove PR preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: docs/build/html
deploy-gh-pages:
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: build-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download docs artifact
uses: actions/download-artifact@v4
with:
name: docs-html
path: docs/build/html
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/build/html
single-commit: true
# Preserve PR preview subdirectories deployed by the deploy-preview job
clean-exclude: pr-preview