Skip to content

Commit

Permalink
new style gh pages deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Oct 18, 2024
1 parent f7710da commit fdc85bd
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions .github/workflows/build-book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,28 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"

- name: Upgrade pip
run: |
# install pip=>20.1 to use "pip cache dir"
python3 -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: python3 -m pip install nox

- name: Build book
run: nox -s docs

# Save html as artifact
# Save html as artifact for CircleCI viewing
- name: Save book html as artifact for viewing
uses: actions/upload-artifact@v4
with:
name: book-html
path: |
_build/html/
# Push the book's HTML to github-pages
- name: Push to GitHub Pages
# Only push if on main branch
- name: Upload gh pages artifact
uses: actions/upload-pages-artifact@v3
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
with:
path: _build/html

# Test for bad links and ensure alt tags for usability
- name: Check HTML using htmlproofer
Expand All @@ -65,3 +48,14 @@ jobs:
--ignore-files "/.+\/_static\/.+/,/genindex.html/"
--ignore-status-codes "404, 403, 429, 503"
continue-on-error: true

deploy:
runs-on: ubuntu-latest
needs: build-book
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4


0 comments on commit fdc85bd

Please sign in to comment.