Skip to content

Commit dfba54e

Browse files
authored
ci(doc): Switch doc-deploy-pr to a dedicated workflow (#2529)
1 parent 5a561c6 commit dfba54e

File tree

2 files changed

+48
-39
lines changed

2 files changed

+48
-39
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened, ready_for_review, closed, labeled]
5+
types: [opened, synchronize, reopened, ready_for_review]
66
branches-ignore:
77
- '*no-ci*'
88
push:
@@ -31,16 +31,14 @@ env:
3131
jobs:
3232
debug:
3333
runs-on: ubuntu-latest
34-
if: github.event.action != 'closed'
3534
steps:
36-
- name: Show the Github context for the triggered event
35+
- name: Show the GitHub context for the triggered event
3736
run: echo "$GITHUB_CONTEXT"
3837
env:
3938
GITHUB_CONTEXT: ${{ toJson(github) }}
4039

4140
pick_server_suffix:
4241
runs-on: ubuntu-latest
43-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
4442
outputs:
4543
suffix: ${{ steps.step1.outputs.suffix }}
4644
steps:
@@ -71,7 +69,6 @@ jobs:
7169
style:
7270
name: "Style Check"
7371
runs-on: ubuntu-latest
74-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
7572
steps:
7673
- uses: ansys/actions/code-style@v8
7774
with:
@@ -80,7 +77,6 @@ jobs:
8077
build_linux1:
8178
name: "Build linux1 wheel"
8279
runs-on: ubuntu-latest
83-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
8480
steps:
8581
- uses: actions/checkout@v4
8682

@@ -111,7 +107,6 @@ jobs:
111107
matrix:
112108
test-any: ['false', 'true']
113109
uses: ./.github/workflows/tests.yml
114-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
115110
needs: pick_server_suffix
116111
with:
117112
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }}
@@ -126,7 +121,6 @@ jobs:
126121
docker_tests:
127122
name: "Build and Test on Docker"
128123
uses: ./.github/workflows/test_docker.yml
129-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
130124
needs: pick_server_suffix
131125
with:
132126
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }}
@@ -136,7 +130,6 @@ jobs:
136130
docker_examples:
137131
name: "Run examples on Docker"
138132
uses: ./.github/workflows/examples_docker.yml
139-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
140133
needs: pick_server_suffix
141134
with:
142135
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }}
@@ -146,8 +139,6 @@ jobs:
146139

147140
docs:
148141
if: |
149-
github.event.action != 'closed' &&
150-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
151142
(startsWith(github.head_ref, 'main') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft)
152143
uses: ./.github/workflows/docs.yml
153144
needs: pick_server_suffix
@@ -158,31 +149,9 @@ jobs:
158149
python_version: "3.11"
159150
secrets: inherit
160151

161-
doc-deploy-pr:
162-
name: "Deploy PR documentation"
163-
runs-on: ubuntu-latest
164-
needs: docs
165-
if: |
166-
always() &&
167-
github.event.pull_request.draft != true &&
168-
(needs.docs.result == 'success' || needs.docs.result == 'skipped') &&
169-
contains(github.event.pull_request.labels.*.name, 'deploy-pr-doc')
170-
steps:
171-
- uses: ansys/actions/doc-deploy-pr@v10
172-
with:
173-
cname: ${{ env.DOCUMENTATION_CNAME }}
174-
token: ${{ secrets.GITHUB_TOKEN }}
175-
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
176-
decompress-artifact: true
177-
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
178-
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
179-
maximum-pr-doc-deployments: 10
180-
181152
upload-development-docs:
182153
runs-on: ubuntu-latest
183154
if: |
184-
github.event.action != 'closed' &&
185-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
186155
(github.ref == 'refs/heads/main' && github.event_name == 'push')
187156
needs: [docs]
188157
steps:
@@ -198,8 +167,6 @@ jobs:
198167

199168
examples:
200169
if: |
201-
github.event.action != 'closed' &&
202-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
203170
(startsWith(github.head_ref, 'main') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft)
204171
uses: ./.github/workflows/examples.yml
205172
needs: pick_server_suffix
@@ -212,8 +179,6 @@ jobs:
212179
pydpf-post:
213180
name: "PyDPF-Post"
214181
if: |
215-
github.event.action != 'closed' &&
216-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
217182
(startsWith(github.head_ref, 'main') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft)
218183
uses: ./.github/workflows/pydpf-post.yml
219184
needs: pick_server_suffix
@@ -227,8 +192,6 @@ jobs:
227192
tests-retro:
228193
name: "Test DPF ${{ matrix.version }} compatibility"
229194
if: |
230-
github.event.action != 'closed' &&
231-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
232195
(startsWith(github.head_ref, 'main') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft)
233196
strategy:
234197
fail-fast: false

.github/workflows/doc-deploy-pr.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: doc-deploy-PR
2+
3+
on:
4+
workflow_run:
5+
workflows: [docs]
6+
types: [completed]
7+
8+
env:
9+
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'
10+
11+
jobs:
12+
debug:
13+
name: debug
14+
runs-on: ubuntu-latest
15+
env:
16+
EVENT_OBJ: ${{ toJson(github.event) }}
17+
steps:
18+
- run: echo $EVENT_OBJ
19+
doc-deploy-pr:
20+
name: "Deploy PR documentation"
21+
runs-on: ubuntu-latest
22+
if: |
23+
github.event.workflow_run.conclusion == 'success' &&
24+
contains(github.event.workflow_run.pull_requests.*.labels.*.name, 'deploy-pr-doc')
25+
steps:
26+
- name: "Download artifacts"
27+
uses: dawidd6/action-download-artifact@v11
28+
with:
29+
workflow: docs.yml
30+
name: HTML-doc-ansys-dpf-core.zip
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
run_id: ${{ github.event.workflow_run.id }}
33+
34+
35+
- name: "Display downloaded files"
36+
run: ls -R
37+
38+
- uses: ansys/actions/doc-deploy-pr@v10
39+
with:
40+
cname: ${{ env.DOCUMENTATION_CNAME }}
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
43+
decompress-artifact: true
44+
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
45+
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
46+
maximum-pr-doc-deployments: 10

0 commit comments

Comments
 (0)