forked from IntelPython/numba-dpex
-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (133 loc) · 4.83 KB
/
gh-pages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: GitHub Pages
on:
push:
branches:
- main
- release*
tags:
- '[0-9]+.[0-9]+*'
pull_request:
types: [opened, synchronize, reopened, closed]
paths:
- 'docs/**'
- environment/docs.yml
- .github/workflows/gh-pages.yml
permissions: read-all
jobs:
main:
if: ${{ !(github.event.pull_request && github.event.action == 'closed') }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.10'
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: "docs"
channels: conda-forge,nodefaults
channel-priority: "disabled"
environment-file: "environment/docs.yml"
- name: Build numba-dpex
run: |
export PATH=$CONDA/bin-llvm:$PATH
CC=icx CXX=icpx python setup.py develop
- name: Make documentation
working-directory: docs
run: make html
- name: GitHub Pages [main]
uses: peaceiris/[email protected]
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html/
destination_dir: ./dev
allow_empty_commit : true
commit_message: ${{ github.event.head_commit.message }}
publish_branch: gh-pages
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
- name: GitHub Pages [PR]
uses: peaceiris/[email protected]
if: ${{ github.event.pull_request && github.event.action != 'closed' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html/
destination_dir: ./pull/${{ github.event.number }}
allow_empty_commit : true
commit_message: ${{ github.event.head_commit.message }}
publish_branch: gh-pages
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
- name: Comment PR [docs created]
if: ${{ github.event.pull_request && github.event.action != 'closed' }}
env:
PR_NUM: ${{ github.event.number }}
uses: mshick/[email protected]
with:
message: |
Documentation preview: [show](https://intelpython.github.io/numba-dpex/pull/${{ env.PR_NUM }}).
# repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish release
if: startsWith(github.ref, 'refs/heads/release')
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir : next_release
publish_dir: docs/_build/html/
allow_empty_commit : true
commit_message: ${{ github.event.head_commit.message }}
- name: Capture tag
id: capture_tag
if: startsWith(github.ref, 'refs/tags/')
run: |
echo ::set-output name=tag_number::${GITHUB_REF#refs/tags/}
- name: Publish tag
if: startsWith(github.ref, 'refs/tags/')
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir : ${{ steps.capture_tag.outputs.tag_number }}
publish_dir: docs/_build/html/
allow_empty_commit : true
commit_message: ${{ github.event.head_commit.message }}
clean:
if: ${{ github.event.pull_request && github.event.action == 'closed' }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: GitHub Pages [PR closed]
env:
PR_NUM: ${{ github.event.number }}
shell: bash -l {0}
run: |
git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/numba-dpex.git
git fetch tokened_docs
git checkout --track tokened_docs/gh-pages
echo `pwd`
[ -d pull/${PR_NUM} ] && git rm -rf pull/${PR_NUM}
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git commit -m "Removing docs for closed pull request ${PR_NUM}"
git push tokened_docs gh-pages
- name: Comment PR [docs removed]
uses: mshick/[email protected]
with:
message: |
Documentation preview removed.
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: 'github-actions[bot]'
allow-repeats: true