Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gh pages deploy #28

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.