1
1
name : build-test-deploy-book
2
2
3
3
# Only build PRs, the main branch, and releases. Pushes to branches will only
4
- # be built when a PR is opened. This avoids duplicated buids in PRs coming
4
+ # be built when a PR is opened. This avoids duplicated builds in PRs coming
5
5
# from branches in the origin repository (1 for PR and 1 for push).
6
6
# This came from Leo's work with fatiando
7
7
on :
@@ -15,57 +15,64 @@ jobs:
15
15
build-test-book :
16
16
runs-on : ubuntu-latest
17
17
steps :
18
- - uses : actions/checkout@v2
18
+ - uses : actions/checkout@v5
19
+ with :
20
+ fetch_depth : 0
19
21
20
- - name : Setup Python
21
- uses : actions/setup-python@v2
22
- with :
23
- python-version : ' 3.9 '
22
+ - name : Restore mtimes from git history
23
+ run : |
24
+ sudo apt-get install git-restore-mtime
25
+ git restore-mtime
24
26
25
- - name : Upgrade pip
26
- run : |
27
- # install pip=>20.1 to use "pip cache dir"
28
- python3 -m pip install --upgrade pip
29
- - name : Get pip cache dir
30
- id : pip-cache
31
- run : echo "::set-output name=dir::$(pip cache dir)"
27
+ - name : Setup Python
28
+ uses : actions/setup-python@v6
29
+ with :
30
+ python-version : " 3.13"
32
31
33
- - name : Cache dependencies
34
- uses : actions/cache@v2
35
- with :
36
- path : ${{ steps. pip-cache.outputs.dir }}
37
- key : ${{ runner.os }}- pip-${{ hashFiles('**/requirements.txt') }}
38
- restore-keys : |
39
- ${{ runner.os }}-pip-
32
+ - name : Upgrade pip
33
+ run : |
34
+ # install pip=>20.1 to use "pip cache dir"
35
+ python3 -m pip install --upgrade pip
36
+ - name : Get pip cache dir
37
+ id : pip-cache
38
+ run : echo "::set-output name=dir::$(pip cache dir)"
40
39
41
- - name : Install dependencies
42
- run : python3 -m pip install nox
40
+ - name : Cache dependencies
41
+ uses : actions/cache@v4
42
+ with :
43
+ path : ${{ steps.pip-cache.outputs.dir }}
44
+ key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
45
+ restore-keys : |
46
+ ${{ runner.os }}-pip-
43
47
44
- - name : Build book
45
- run : nox -s docs
48
+ - name : Install dependencies
49
+ run : python3 -m pip install nox
46
50
47
- # Save html as artifact
48
- - name : Save book html as artifact for viewing
49
- uses : actions/upload-artifact@v3
50
- with :
51
- name : book-html
52
- path : |
53
- _build/html/
51
+ - name : Build book
52
+ run : nox -s docs-test
54
53
55
- # Push the book's HTML to github-pages
56
- - name : Push to GitHub Pages
57
- # Only push if on main branch
58
- if : github.ref == 'refs/heads/main'
59
-
60
- with :
61
- github_token : ${{ secrets.GITHUB_TOKEN }}
62
- publish_dir : ./_build/html
54
+ # Save html as artifact
55
+ - name : Save book html as artifact for viewing
56
+ uses : actions/upload-artifact@v4
57
+ with :
58
+ name : book-html
59
+ path : |
60
+ _build/html/
63
61
64
- # Test for bad links and ensure alt tags for usability
65
- - name : Check HTML using htmlproofer
66
- uses : chabad360/htmlproofer@master
67
- with :
68
- directory : ' _build/html'
69
- arguments : |
70
- --ignore-files "/.+\/_static\/.+/,/genindex.html/"
71
- --ignore-status-codes "404, 403, 503"
62
+ # Push the book's HTML to github-pages
63
+ - name : Push to GitHub Pages
64
+ # Only push if on main branch
65
+ if : github.ref == 'refs/heads/main'
66
+
67
+ with :
68
+ github_token : ${{ secrets.GITHUB_TOKEN }}
69
+ publish_dir : ./_build/html
70
+
71
+ # Test for bad links and ensure alt tags for usability
72
+ - name : Check HTML using htmlproofer
73
+ uses : chabad360/htmlproofer@master
74
+ with :
75
+ directory : " _build/html"
76
+ arguments : |
77
+ --ignore-files "/.+\/_static\/.+/,/genindex.html/"
78
+ --ignore-status-codes "0, 200, 403, 429, 503"
0 commit comments