DEBUG: DEPLOY ON PUSH #274
Workflow file for this run
This file contains 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 Jupyter Book | |
on: | |
push: | |
# branches: | |
# - main | |
pull_request: | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-book: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up pixi | |
uses: prefix-dev/setup-pixi@v0.8.1 | |
with: | |
cache: true | |
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
- name: List installed packages | |
run: | | |
pixi list --environment book | |
- name: Set track_progress=False for notebooks | |
run: | | |
git config --global --add safe.directory /__w/pyhf-tutorial/pyhf-tutorial | |
git grep --name-only "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g' | |
- name: Build the book | |
run: | | |
pixi run build | |
- name: Upload jupyter book | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jupyterbook | |
path: 'book/_build/html/' | |
build-pyodide: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "latest" | |
- name: Install pyodide | |
run: | | |
uv pip install --system --upgrade \ | |
"jupyterlite[lab]" \ | |
"jupytext>=1.14.0" | |
- name: List installed Python packages | |
run: | | |
python -m pip list | |
- name: Convert .py to notebook | |
run: | | |
jupytext --to notebook lite/jupyterlite.py | |
cp lite/*.ipynb book/ | |
- name: Build the Pyodide output | |
run: | | |
jupyter lite --help | |
jupyter lite init | |
jupyter lite build --contents=book | |
jupyter lite check | |
- name: Upload Pyodide build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jupyterlite | |
path: _output/ | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: [build-book, build-pyodide] | |
# if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: jupyterbook | |
path: 'public' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: jupyterlite | |
path: 'public/live' | |
- name: Fix permissions | |
run: | | |
chmod -c -R +rX "public/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'public' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |