Skip to content

Commit

Permalink
Merge pull request #28 from sneakers-the-rat/fix-gh-pages-deploy
Browse files Browse the repository at this point in the history
Fix gh pages deploy
  • Loading branch information
sneakers-the-rat authored Oct 18, 2024
2 parents 49e67a0 + fdc85bd commit 526467b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 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


2 changes: 0 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
@nox.session
def docs(session):
"""Build the packaging guide."""
session.install("-r", "requirements.txt")
session.install("-e", ".")
session.run(
SPHINX_BUILD,
Expand Down Expand Up @@ -100,7 +99,6 @@ def docs_live(session):
so they don't need to remember the specific sphinx-build parameters to build a different language.
"""
session.install("-e", ".[dev]")
session.install("-r", "requirements.txt")
if not os.path.exists(OUTPUT_DIR):
os.makedirs(OUTPUT_DIR)
# Make sure jupy text syncs things
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies = [
"sphinx-inline-tabs",
# for project cards
"matplotlib",
"pandas",
]

[project.optional-dependencies]
Expand Down
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

0 comments on commit 526467b

Please sign in to comment.