1
-
2
1
name : Docs CI
3
2
4
3
on :
7
6
8
7
jobs :
9
8
build :
9
+ name : " Docs CI"
10
10
runs-on : ubuntu-latest
11
11
12
12
steps :
13
13
- name : Checkout Source
14
14
uses : actions/checkout@v2
15
15
with :
16
- # require all of history to see all tagged versions' docs
16
+ # require history to get back to last tag for version number of branches
17
17
fetch-depth : 0
18
+ submodules : true
18
19
19
20
- name : Set up Python
20
21
uses : actions/setup-python@v2
21
22
with :
22
- python-version : " 3.7"
23
-
24
- - name : Install Packages
25
- # Can delete this if you don't use graphviz in your docs
26
- run : sudo apt-get install graphviz
23
+ python-version : " 3.9"
27
24
28
25
- name : Install Python Dependencies
29
26
run : |
30
27
pip install pipenv
31
28
pipenv install --dev --deploy --python $(which python) && pipenv graph
32
-
33
- - name : Deploy index
34
- # We pin to the SHA, not the tag, for security reasons.
35
- # https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
36
- uses : peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
37
- with :
38
- github_token : ${{ secrets.GITHUB_TOKEN }}
39
- publish_dir : .github/pages
40
- keep_files : true
41
-
42
- - name : Checkout gh-pages
43
- # As we already did a deploy of gh-pages above, it is guaranteed to be there
44
- # so check it out so we can selectively build docs below
45
- uses : actions/checkout@v2
46
- with :
47
- ref : gh-pages
48
- path : build/html
49
-
50
- - name : Maybe use sphinx-multiversion
51
- # If we are building main or a tag we will publish
52
- if : github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')
53
- # So use the args we normally pass to sphinx-build, but run sphinx-multiversion
54
- run : mv $(pipenv --venv)/bin/sphinx-multiversion $(pipenv --venv)/bin/sphinx-build
55
-
56
29
- name : Build Docs
57
30
run : pipenv run docs
58
31
32
+ - name : Move to versioned directory
33
+ # e.g. master or 0.1.2
34
+ run : mv build/html ".github/pages/${GITHUB_REF##*/}"
35
+
59
36
- name : Publish Docs to gh-pages
60
- # Only main and tags are published
61
- if : github.ref == 'refs/heads/main ' || startsWith(github.ref, 'refs/tags')
37
+ # Only master and tags are published
38
+ if : " ${{ github.repository_owner == 'dls-controls' && (github. ref == 'refs/heads/master ' || startsWith(github.ref, 'refs/tags')) }} "
62
39
# We pin to the SHA, not the tag, for security reasons.
63
- # https://docs.github.com/en/free-pro-team@latest/ actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
40
+ # https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
64
41
uses : peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
65
42
with :
66
43
github_token : ${{ secrets.GITHUB_TOKEN }}
67
- publish_dir : build/html
68
- keep_files : true
69
-
44
+ publish_dir : .github/pages
45
+ keep_files : true
0 commit comments