Merge pull request #2 from marco-2023/fix_website #60
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: deploy-book | |
| # Only run this when the master branch changes | |
| on: | |
| push: | |
| branches: [master, website] | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| branches: | |
| - main | |
| # If your git repository has the Jupyter Book within some-subfolder next to | |
| # unrelated files, you can make this run only if a file within that specific | |
| # folder has been modified. | |
| # | |
| #paths: | |
| #- book/ | |
| # This job installs dependencies, builds the book, and pushes it to `gh-pages` | |
| jobs: | |
| deploy-book: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| # https://github.com/JamesIves/github-pages-deploy-action/issues/1110 | |
| contents: write | |
| env: | |
| ACTIONS_STEP_DEBUG: true | |
| PYTHONUNBUFFERED: 1 | |
| JUPYTER_BOOK_VERBOSE: 1 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Debug OS | |
| run: | | |
| uname -a | |
| df -h | |
| env | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Debug Python environment | |
| run: | | |
| python3 -VV | |
| pip3 debug | |
| pip3 list | |
| - name: Install dependencies and make C++ library | |
| run: | | |
| set -x | |
| python3 -m pip install --upgrade pip | |
| python3 -m pip install numpy scipy pytest pycodestyle pydocstyle --verbose | |
| PYTHON=python3 make | |
| python3 -m pip install . --verbose | |
| - name: Install Jupyter Book dependencies | |
| run: | | |
| set -x | |
| python3 -m pip install -r website/requirements.txt --verbose | |
| - name: Add soft links to notebooks | |
| run: | | |
| set -x | |
| cd website | |
| ln -s ../notebooks ./examples | |
| ln -s ../doc/source ./api | |
| ls -l | |
| cd .. | |
| - name: Validate symlinks | |
| run: | | |
| set -x | |
| cd website | |
| ls -l . | |
| ls -l examples || true | |
| ls -l api || true | |
| cd .. | |
| - name: Build the website | |
| run: | | |
| set -x | |
| jupyter-book build ./website/ --verbose --keep-going | |
| - name: Verify build succeeded | |
| run: | | |
| set -x | |
| if [ -f website/_build/html/index.html ]; then | |
| echo "Jupyter Book build succeeded!" | |
| else | |
| echo "Build failed: index.html not found" | |
| exit 1 | |
| fi | |
| # Push the book's HTML to github-pages | |
| # inspired by https://github.com/orgs/community/discussions/26724 | |
| # only push to gh-pages if the master branch has been updated | |
| - name: GitHub Pages Action | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./website/_build/html | |
| publish_branch: gh-pages | |
| cname: pyci.qcdevs.org | |
| - name: Upload build logs | |
| if: failure() | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: website-build-logs | |
| path: | | |
| website/_build |