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,44 +16,54 @@ 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
46
53
- name : Checkout repo
54
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
47
55
uses : actions/checkout@v2
48
56
with :
49
57
fetch-depth : 0
50
58
- name : Build dpctl
59
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
51
60
shell : bash -l {0}
52
61
run : |
53
62
source /opt/intel/oneapi/setvars.sh
54
63
python setup.py develop
55
64
python -c "import dpctl; print(dpctl.__version__)"
56
65
- name : Build docs
66
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
57
67
shell : bash -l {0}
58
68
run : |
59
69
# Ensure that SYCL libraries are on LD_LIBRARY_PATH
87
97
git commit -m "Latest docs."
88
98
git push tokened_docs gh-pages
89
99
- name : Publish pull-request docs
90
- if : ${{ github.ref != 'refs/heads/master ' }}
100
+ if : ${{ github.event.pull_request && github.event.action != 'closed ' }}
91
101
env :
92
102
PR_NUM : ${{ github.event.number }}
93
103
shell : bash -l {0}
@@ -105,8 +115,23 @@ jobs:
105
115
git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
106
116
git commit -m "Docs for pull request ${PR_NUM}"
107
117
git push tokened_docs gh-pages
108
- - name : Comment with URL to pull-request docs
109
- if : ${{ github.ref != 'refs/heads/master' }}
118
+ - name : Unpublished pull-request docs
119
+ if : ${{ github.event.pull_request && github.event.action == 'closed' }}
120
+ env :
121
+ PR_NUM : ${{ github.event.number }}
122
+ shell : bash -l {0}
123
+ run : |
124
+ git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
125
+ git fetch tokened_docs
126
+ git checkout --track tokened_docs/gh-pages
127
+ echo `pwd`
128
+ [ -d pulls/${PR_NUM} ] && git rm -rf pulls/${PR_NUM}
129
+ git config --global user.name 'github-actions[doc-deploy-bot]'
130
+ git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
131
+ git commit -m "Removing docs for closed pull request ${PR_NUM}"
132
+ git push tokened_docs gh-pages
133
+ - name : Comment with URL to published pull-request docs
134
+ if : ${{ github.event.pull_request && github.event.action != 'closed' }}
110
135
env :
111
136
PR_NUM : ${{ github.event.number }}
112
137
uses : mshick/add-pr-comment@v1
@@ -115,3 +140,13 @@ jobs:
115
140
View rendered docs @ https://intelpython.github.io/dpctl/pulls/${{ env.PR_NUM }}/index.html
116
141
repo-token : ${{ secrets.GITHUB_TOKEN }}
117
142
repo-token-user-login : ' github-actions[bot]'
143
+ - name : Comment with URL about removal of PR docs
144
+ if : ${{ github.event.pull_request && github.event.action == 'closed' }}
145
+ env :
146
+ PR_NUM : ${{ github.event.number }}
147
+ uses : mshick/add-pr-comment@v1
148
+ with :
149
+ message : |
150
+ Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. :crossed_fingers:
151
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
152
+ repo-token-user-login : ' github-actions[bot]'
0 commit comments