7
7
types : [opened, synchronize, reopened, closed]
8
8
9
9
env :
10
+ GITHUB_BOT_NAME : ' github-actions[bot]'
11
+ GITHUB_BOT_EMAIL : ' github-actions[bot]@users.noreply.github.com'
10
12
PUBLISH_DIR : doc/_build/html/
11
13
12
14
defaults :
@@ -125,36 +127,46 @@ jobs:
125
127
working-directory : ' dpnp/backend/doc'
126
128
127
129
- name : Copy backend docs
128
- run : cp -r dpnp/backend/doc/html doc/_build/html /backend_doc
130
+ run : cp -r dpnp/backend/doc/html ${{ env.PUBLISH_DIR }} /backend_doc
129
131
130
132
# https://github.com/marketplace/actions/github-pages-action
133
+ # The step is only used to build docs while pushing PR to "master"
131
134
- name : Deploy docs
132
135
if : |
133
- github.event.pull_request && ! github.event.pull_request.head.repo.fork &&
134
- ( github.ref == 'refs/heads/master' || (startsWith( github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains( github.ref, 'refs/tags/'))
136
+ github.ref == 'refs/heads/master' && github.event_name == 'push' &&
137
+ github.event. ref == 'refs/heads/master' && github.event.repository && ! github.event.repository.fork
135
138
136
139
with :
137
140
github_token : ${{ secrets.GITHUB_TOKEN }}
138
141
publish_dir : ${{ env.PUBLISH_DIR }}
142
+ keep_files : true
143
+ commit_message : ${{ github.event.head_commit.message }}
144
+ publish_branch : gh-pages
145
+ user_name : ${{ env.GITHUB_BOT_NAME }}
146
+ user_email : ${{ env.GITHUB_BOT_EMAIL }}
139
147
148
+ # The step is only used to build docs while pushing to PR branch
140
149
- name : Publish pull-request docs
141
150
if : |
142
- github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action != 'closed'
151
+ github.event_name == 'pull_request' && github.event.action != 'closed' &&
152
+ github.event.pull_request && !github.event.pull_request.head.repo.fork
143
153
144
154
with :
145
155
github_token : ${{ secrets.GITHUB_TOKEN }}
146
156
publish_dir : ${{ env.PUBLISH_DIR }}
147
157
destination_dir : ./pull/${{ github.event.number }}
148
158
allow_empty_commit : true
149
159
keep_files : true
150
- commit_message : ${{ github.event.head_commit.message }}
160
+ commit_message : ${{ github.event.pull_request.title }}
151
161
publish_branch : gh-pages
152
- user_name : ' github-actions[bot] '
153
- user_email : ' github-actions[bot]@users.noreply.github.com '
162
+ user_name : ${{ env.GITHUB_BOT_NAME }}
163
+ user_email : ${{ env.GITHUB_BOT_EMAIL }}
154
164
165
+ # The step is only used to build docs while pushing to PR branch
155
166
- name : Comment with URL to published pull-request docs
156
167
if : |
157
- github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action != 'closed'
168
+ github.event_name == 'pull_request' && github.event.action != 'closed' &&
169
+ github.event.pull_request && !github.event.pull_request.head.repo.fork
158
170
env :
159
171
PR_NUM : ${{ github.event.number }}
160
172
@@ -163,9 +175,11 @@ jobs:
163
175
View rendered docs @ https://intelpython.github.io/dpnp/pull/${{ env.PR_NUM }}/index.html
164
176
allow-repeats : false
165
177
178
+ # The job is only used to build docs when PR is closed (action from PR branch)
166
179
clean :
167
180
if : |
168
- github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action == 'closed'
181
+ github.event_name == 'pull_request' && github.event.action == 'closed' &&
182
+ github.event.pull_request && !github.event.pull_request.head.repo.fork
169
183
170
184
needs : build-and-deploy
171
185
@@ -185,8 +199,8 @@ jobs:
185
199
git checkout --track tokened_docs/gh-pages
186
200
echo `pwd`
187
201
[ -d pull/${PR_NUM} ] && git rm -rf pull/${PR_NUM}
188
- git config --global user.name 'github-actions[bot]'
189
- git config --global user.email 'github-actions[bot]@users.noreply.github.com'
202
+ git config --global user.name ${{ env.GITHUB_BOT_NAME }}
203
+ git config --global user.email ${{ env.GITHUB_BOT_EMAIL }}
190
204
git commit -m "Removing docs for closed pull request ${PR_NUM}"
191
205
git push tokened_docs gh-pages
192
206
0 commit comments