docstrings_simulators_updated #93
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: Build Python Sphinx Docs and push to gh-pages | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request_target: | |
| types: closed | |
| branches: master | |
| repository_dispatch: | |
| types: [docstrings_common_updated, docstrings_simulators_updated] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all tags and branches | |
| - name: Create tmp directories for master | |
| run: | | |
| mkdir python/master-tmp | |
| - name: Get docstrings_common.json from master branch of opm-common | |
| run: | | |
| curl -L -o python/master-tmp/docstrings_common.json https://raw.githubusercontent.com/OPM/opm-common/master/python/docstrings_common.json | |
| - name: Get docstrings_common.json from master branch of opm-simulators | |
| run: | | |
| curl -L -o python/master-tmp/docstrings_simulators.json https://raw.githubusercontent.com/OPM/opm-simulators/master/python/docstrings_simulators.json | |
| - name: Get dune.module from master branch of opm-simulators, this is needed for the call to extract_opm_simulators_release in python/sphinx_docs/docs/conf.py. | |
| run: | | |
| curl -L -o python/master-tmp/dune.module https://raw.githubusercontent.com/OPM/opm-simulators/master/dune.module | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install poetry | |
| uses: OPM/actions-poetry@master | |
| - name: Install python dependencies | |
| run: | | |
| cd python/sphinx_docs | |
| poetry install | |
| - name: Build documentation | |
| run: | | |
| cd python | |
| mkdir gh-pages | |
| touch gh-pages/.nojekyll | |
| cd sphinx_docs | |
| # To add a new relase to this build system: | |
| # - add the respective branch <your-new-release> on this repository, replace the slashes "/" by dashes "-" | |
| # (slashes mess with the navigation html created by sphinx-versioned) | |
| # - take a snapshot of https://raw.githubusercontent.com/OPM/opm-common/<your-new-release>/python/docstrings_common.json, | |
| # https://raw.githubusercontent.com/OPM/opm-simulators/<your-new-release>/python/docstrings_simulators.json and | |
| # https://raw.githubusercontent.com/OPM/opm-simulators/<your-new-release>/dune.module and put them | |
| # in the python folder on that branch | |
| # - add the respective branch <your-new-release> in the command below | |
| if [ "${{ github.ref_name }}" == "master" ]; then | |
| poetry run sphinx-versioned -m master -b "master release-2025.04" --force --git-root ../../ | |
| else | |
| poetry run sphinx-versioned -m master -b "${{ github.ref_name }} master release-2025.04" --force --git-root ../../ | |
| fi | |
| - name: Copy documentation to gh-pages | |
| run: | | |
| cp -r python/sphinx_docs/docs/_build/* python/gh-pages | |
| - name: Deploy documentation for PR merge to master or push to master | |
| if: github.ref == 'refs/heads/master' | |
| uses: OPM/github-pages-deploy-action@releases/v4 | |
| with: | |
| branch: gh-pages | |
| folder: python/gh-pages | |
| - name: Deploy documentation for other branches (on forks) | |
| if: github.event_name == 'push' && github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/release') | |
| uses: OPM/github-pages-deploy-action@releases/v4 | |
| with: | |
| branch: gh-pages-${{ github.ref_name }} | |
| folder: python/gh-pages |