Skip to content

Commit a681cb2

Browse files
authored
Fix: update build steps (#626)
* Fix: update build steps * Fix: update build steps
1 parent 8c0258c commit a681cb2

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

.github/workflows/build-book.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ on:
1010
branches:
1111
- main
1212

13+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
1319
# This job installs dependencies, build the book, and pushes it to `gh-pages`
1420
jobs:
1521
build-test-book:
1622
runs-on: ubuntu-latest
1723
steps:
18-
- uses: actions/checkout@v6
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1925
with:
2026
fetch_depth: 0
2127

@@ -25,7 +31,7 @@ jobs:
2531
git restore-mtime
2632
2733
- name: Setup Python
28-
uses: actions/setup-python@v6
34+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2935
with:
3036
python-version: "3.13"
3137

@@ -38,7 +44,7 @@ jobs:
3844
run: echo "::set-output name=dir::$(pip cache dir)"
3945

4046
- name: Cache dependencies
41-
uses: actions/cache@v5
47+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
4248
with:
4349
path: ${{ steps.pip-cache.outputs.dir }}
4450
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -50,6 +56,9 @@ jobs:
5056

5157
- name: Build book
5258
run: nox -s docs-test
59+
- name: Setup Pages
60+
id: pages
61+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d #v6
5362

5463
# Save html as artifact
5564
- name: Save book html as artifact for viewing
@@ -59,14 +68,17 @@ jobs:
5968
path: |
6069
_build/html/
6170
62-
# Push the book's HTML to github-pages
63-
- name: Push to GitHub Pages
71+
- name: Upload artifact
72+
# Automatically uploads an artifact from the './_site' directory by default
73+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b #v4
74+
with:
75+
path: ./_build/html
76+
77+
- name: Deploy to GitHub Pages
6478
# Only push if on main branch
6579
if: github.ref == 'refs/heads/main'
66-
uses: peaceiris/actions-gh-pages@v4.0.0
67-
with:
68-
github_token: ${{ secrets.GITHUB_TOKEN }}
69-
publish_dir: ./_build/html
80+
id: deployment
81+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 #v5.0.0
7082

7183
# Test for bad links and ensure alt tags for usability
7284
- name: Check HTML using htmlproofer
@@ -75,4 +87,4 @@ jobs:
7587
directory: "_build/html"
7688
arguments: |
7789
--ignore-files "/.+\/_static\/.+/,/genindex.html/"
78-
--ignore-status-codes "0, 200, 403, 429, 503"
90+
--ignore-status-codes "0, 200, 401, 403, 429, 503"

0 commit comments

Comments
 (0)