Skip to content

Commit 738372b

Browse files
Temporary commit to see new doc
1 parent b3cd1d4 commit 738372b

File tree

1 file changed

+69
-5
lines changed

1 file changed

+69
-5
lines changed

.github/workflows/build-sphinx.yml

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ on:
44
branches:
55
- master
66
pull_request:
7+
types: [opened, synchronize, reopened, closed]
8+
9+
env:
10+
PUBLISH_DIR: doc/_build/html/
11+
12+
defaults:
13+
run:
14+
shell: bash -l {0}
715

816
jobs:
917
build-and-deploy:
1018
name: Build and Deploy Docs
1119

1220
runs-on: ubuntu-20.04
1321

14-
defaults:
15-
run:
16-
shell: bash -l {0}
17-
1822
env:
1923
python-ver: '3.9'
2024
CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
@@ -116,4 +120,64 @@ jobs:
116120
uses: peaceiris/[email protected]
117121
with:
118122
github_token: ${{ secrets.GITHUB_TOKEN }}
119-
publish_dir: doc/_build/html/
123+
publish_dir: ${{ env.PUBLISH_DIR }}
124+
125+
- name: Publish pull-request docs
126+
if: |
127+
!github.event.pull_request.head.repo.fork && github.event.pull_request && github.event.action != 'closed'
128+
uses: peaceiris/[email protected]
129+
with:
130+
github_token: ${{ secrets.GITHUB_TOKEN }}
131+
publish_dir: ${{ env.PUBLISH_DIR }}
132+
destination_dir: ./pull/${{ github.event.number }}
133+
allow_empty_commit : true
134+
commit_message: ${{ github.event.head_commit.message }}
135+
publish_branch: gh-pages
136+
user_name: 'github-actions[bot]'
137+
user_email: 'github-actions[bot]@users.noreply.github.com'
138+
139+
- name: Comment with URL to published pull-request docs
140+
if: |
141+
!github.event.pull_request.head.repo.fork && github.event.pull_request && github.event.action != 'closed'
142+
env:
143+
PR_NUM: ${{ github.event.number }}
144+
uses: mshick/[email protected]
145+
with:
146+
message: |
147+
View rendered docs @ https://intelpython.github.io/dpnp/pulls/${{ env.PR_NUM }}/index.html
148+
allow-repeats: false
149+
150+
clean:
151+
if: |
152+
!github.event.pull_request.head.repo.fork && github.event.pull_request && github.event.action == 'closed'
153+
154+
needs: build-and-deploy
155+
156+
runs-on: ubuntu-20.04
157+
158+
steps:
159+
- uses: actions/[email protected]
160+
with:
161+
fetch-depth: 0
162+
163+
- name: Remove docs [PR closed]
164+
env:
165+
PR_NUM: ${{ github.event.number }}
166+
run: |
167+
git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpnp.git
168+
git fetch tokened_docs
169+
git checkout --track tokened_docs/gh-pages
170+
echo `pwd`
171+
[ -d pull/${PR_NUM} ] && git rm -rf pull/${PR_NUM}
172+
git config --global user.name 'github-actions[bot]'
173+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
174+
git commit -m "Removing docs for closed pull request ${PR_NUM}"
175+
git push tokened_docs gh-pages
176+
177+
- name: Modify the comment with URL to official documentation
178+
uses: mshick/[email protected]
179+
with:
180+
find: |
181+
View rendered docs @.+
182+
replace: |
183+
View rendered docs @ https://intelpython.github.io/dpnp/index.html

0 commit comments

Comments
 (0)