doc work #30
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: Build and publish documentation | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' #pattern match | |
branches: | |
- main | |
- tk_volatile | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub | |
# Pages. These were copied from workflows generated by the github UI. | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run | |
# in-progress and latest queued. However, do NOT cancel in-progress runs as we | |
# want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build-and-deploy: | |
# environment: #TODO | |
# name: github-pages | |
# url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
env: | |
CONDA_SOLVER: libmamba | |
steps: | |
- name: Checkout main repository | |
uses: actions/checkout@v3 | |
#Note: We get all history and tags, so the version detection will always | |
#be able to yield vx.y.z for the main website: | |
with: | |
fetch-depth: 0 | |
#Old version from when we didn't need geant4 for the docs: | |
# - name: Setup conda environment | |
# uses: conda-incubator/setup-miniconda@v2 | |
# with: | |
# activate-environment: publish-doc-condaenv | |
# environment-file: .github/resources/publish-doc-condaenv.yml | |
# #use-mamba: no | |
# | |
#Since we need geant4 for the docs, we use the smart method from | |
#condatest.yml, and then update afterwards: | |
- name: Setup conda environment | |
uses: ./.github/actions/setup | |
with: | |
PYTHON_VERSION: 3.11 | |
USE_MAMBA: true | |
CACHED_NOARCH_DEF_PY_FILE: ./.github/resources/cached_noarch_definitions.py | |
CONDA_ENV_FILE : ./.github/resources/conda-setup.yml | |
- name: Update conda env for docs | |
#NB: We do NOT add --prune in the next link, since | |
#conda-setup_extra_for_docs.yml only contains the extra dependencies | |
run: conda env update --name simplebuild_dgcode --file ./.github/resources/conda-setup_extra_for_docs.yml | |
- name: Install self | |
run: python3 -mpip install . | |
- name: Build documentation | |
#NB: -W to turn warnings into errors: | |
#NB: SIMPLEBUILD_GITVERSION_USE_LATEST_VTAG=1 to show vx.y.z on website, | |
#even if making additional commits (e.g. with updates for workflows). | |
run: SIMPLEBUILD_GITVERSION_USE_LATEST_VTAG=1 make html SPHINXOPTS="-W" | |
working-directory: ./doc/ | |
# - name: Debug | |
# run: | | |
# conda list | |
# ls test_sphinx_doc/docs/build/ | |
# - name: Setup Pages | |
# uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: './doc/build/html' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |