4
4
branches :
5
5
- master
6
6
pull_request :
7
-
7
+ types : [opened, synchronize, reopened, closed]
8
8
9
9
jobs :
10
10
build-and-deploy :
@@ -16,30 +16,37 @@ jobs:
16
16
with :
17
17
access_token : ${{ github.token }}
18
18
- name : Add Intel repository
19
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
19
20
run : |
20
21
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
21
22
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
22
23
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
23
24
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
24
25
sudo apt-get update
25
26
- name : Install Intel OneAPI
27
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
26
28
run : |
27
29
sudo apt-get install intel-oneapi-dpcpp-cpp-compiler
28
30
- name : Install Lua
31
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
29
32
run : |
30
33
sudo apt-get install liblua5.2-dev
31
34
- name : Install Doxygen
35
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
32
36
run : |
33
37
sudo apt-get install doxygen
34
38
- name : Install CMake
39
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
35
40
run : |
36
41
sudo apt-get install cmake
37
42
- name : Setup Python
43
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
38
44
uses : actions/setup-python@v2
39
45
with :
40
46
python-version : ' 3.8'
41
47
architecture : x64
42
48
- name : Install sphinx dependencies
49
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
43
50
shell : bash -l {0}
44
51
run : |
45
52
pip install numpy cython setuptools sphinx sphinx_rtd_theme pydot graphviz
@@ -48,12 +55,14 @@ jobs:
48
55
with :
49
56
fetch-depth : 0
50
57
- name : Build dpctl
58
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
51
59
shell : bash -l {0}
52
60
run : |
53
61
source /opt/intel/oneapi/setvars.sh
54
62
python setup.py develop
55
63
python -c "import dpctl; print(dpctl.__version__)"
56
64
- name : Build docs
65
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
57
66
shell : bash -l {0}
58
67
run : |
59
68
# Ensure that SYCL libraries are on LD_LIBRARY_PATH
87
96
git commit -m "Latest docs."
88
97
git push tokened_docs gh-pages
89
98
- name : Publish pull-request docs
90
- if : ${{ github.ref != 'refs/heads/master ' }}
99
+ if : ${{ github.event.pull_request && github.event.action != 'closed ' }}
91
100
env :
92
101
PR_NUM : ${{ github.event.number }}
93
102
shell : bash -l {0}
@@ -105,8 +114,23 @@ jobs:
105
114
git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
106
115
git commit -m "Docs for pull request ${PR_NUM}"
107
116
git push tokened_docs gh-pages
108
- - name : Comment with URL to pull-request docs
109
- if : ${{ github.ref != 'refs/heads/master' }}
117
+ - name : Unpublished pull-request docs
118
+ if : ${{ github.event.pull_request && github.event.action == 'closed' }}
119
+ env :
120
+ PR_NUM : ${{ github.event.number }}
121
+ shell : bash -l {0}
122
+ run : |
123
+ git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
124
+ git fetch tokened_docs
125
+ git checkout --track tokened_docs/gh-pages
126
+ echo `pwd`
127
+ [ -d pulls/${PR_NUM} ] && git rm -rf pulls/${PR_NUM}
128
+ git config --global user.name 'github-actions[doc-deploy-bot]'
129
+ git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
130
+ git commit -m "Removing docs for closed pull request ${PR_NUM}"
131
+ git push tokened_docs gh-pages
132
+ - name : Comment with URL to published pull-request docs
133
+ if : ${{ github.event.pull_request && github.event.action != 'closed' }}
110
134
env :
111
135
PR_NUM : ${{ github.event.number }}
112
136
uses : mshick/add-pr-comment@v1
@@ -115,3 +139,13 @@ jobs:
115
139
View rendered docs @ https://intelpython.github.io/dpctl/pulls/${{ env.PR_NUM }}/index.html
116
140
repo-token : ${{ secrets.GITHUB_TOKEN }}
117
141
repo-token-user-login : ' github-actions[bot]'
142
+ - name : Comment with URL about removal of PR docs
143
+ if : ${{ github.event.pull_request && github.event.action == 'closed' }}
144
+ env :
145
+ PR_NUM : ${{ github.event.number }}
146
+ uses : mshick/add-pr-comment@v1
147
+ with :
148
+ message : |
149
+ Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. :crossed_fingers:
150
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
151
+ repo-token-user-login : ' github-actions[bot]'
0 commit comments