Skip to content

Build and Deploy

Build and Deploy #218

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # Every day at midnight UTC
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions: {}
env:
FORCE_COLOR: 3
SPHINXOPTS: "-W --keep-going -j auto -D jupyterlite_silence=0"
jobs:
build-sites:
name: Build Sphinx ${{ matrix.site[0] }} site
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
site: [[pyodide-kernel-example, pyodide], [xeus-kernel-example, xeus]]
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: "3.12"
activate-environment: true
- name: Install micromamba for Xeus kernel example site
uses: mamba-org/setup-micromamba@b09ef9b599704322748535812ca03efb2625677b # v2.0.5
if: matrix.site[0] == 'xeus-kernel-example'
- name: Install dependencies
working-directory: ${{ matrix.site[0] }}
run: uv pip install -r requirements.txt
- name: Build Sphinx site for ${{ matrix.site[0] }}
working-directory: ${{ matrix.site[0] }}/docs
run: make html
- name: Upload site artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ matrix.site[1] }}
path: ${{ matrix.site[0] }}/docs/build/html
retention-days: 7
if-no-files-found: error
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build-sites
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
permissions:
contents: write
pages: write
deployments: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: dist
- name: Move base index and version switcher JSON
run: |
mv index.html dist/index.html
mv switcher.json dist/switcher.json
- name: Sanity check build artifacts
run: tree dist
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
force_orphan: true
publish_dir: ./dist
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"