| 1 |
name: Build documentation |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_call: |
| 5 |
inputs: |
| 6 |
tag: |
| 7 |
description: "Tag of DOLFINx docker image" |
| 8 |
default: "nightly" |
| 9 |
required: true |
| 10 |
type: string |
| 11 |
workflow_dispatch: |
| 12 |
inputs: |
| 13 |
tag: |
| 14 |
description: "Tag of DOLFINx docker image" |
| 15 |
default: "nightly" |
| 16 |
required: true |
| 17 |
type: string |
| 18 |
push: |
| 19 |
branches: |
| 20 |
- main |
| 21 |
pull_request: |
| 22 |
branches: |
| 23 |
- main |
| 24 |
schedule: |
| 25 |
- cron: "0 8 * * *" |
| 26 |
|
| 27 |
env: |
| 28 |
DEB_PYTHON_INSTALL_LAYOUT: deb_system |
| 29 |
DEFAULT_TAG: nightly |
| 30 |
ARTIFACT_NAME: docs |
| 31 |
PUBLISH_DIR: ./_build/html |
| 32 |
|
| 33 |
jobs: |
| 34 |
get_image_tag: |
| 35 |
runs-on: ubuntu-latest |
| 36 |
outputs: |
| 37 |
image: ${{ steps.docker_tag.outputs.image }} |
| 38 |
steps: |
| 39 |
- id: docker_tag |
| 40 |
run: echo "image=${{ inputs.tag || env.DEFAULT_TAG }}" >> $GITHUB_OUTPUT |
| 41 |
|
| 42 |
build-docs: |
| 43 |
needs: get_image_tag |
| 44 |
runs-on: ubuntu-latest |
| 45 |
container: ghcr.io/fenics/dolfinx/dolfinx:${{ needs.get_image_tag.outputs.image }} |
| 46 |
|
| 47 |
steps: |
| 48 |
# This action sets the current path to the root of your github repo |
| 49 |
- uses: actions/checkout@v5 |
| 50 |
|
| 51 |
- name: Update pip |
| 52 |
run: python3 -m pip install --break-system-packages --upgrade pip setuptools |
| 53 |
|
| 54 |
- name: Install dependencies |
| 55 |
run: python3 -m pip install --break-system-packages -e ".[docs]" |
| 56 |
|
| 57 |
- name: Build docs |
| 58 |
run: jupyter book build . |
| 59 |
|
| 60 |
- name: Upload documentation as artifact |
| 61 |
uses: actions/upload-artifact@v4 |
| 62 |
if: always() |
| 63 |
with: |
| 64 |
name: ${{ env.ARTIFACT_NAME }} |
| 65 |
path: ${{ env.PUBLISH_DIR }} |
| 66 |
if-no-files-found: error |