Bump nwtgck/actions-netlify from 2.0 to 2.1 (#5152) #1
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 Documentation | |
on: | |
pull_request: # Uses cache | |
workflow_dispatch: # Able to not use cache by user demand | |
inputs: | |
cache: | |
description: 'Use build cache' | |
required: false | |
default: "true" | |
# No cache enabled for `schedule` and `push` | |
schedule: | |
- cron: '0 0 1 * *' # once a month on main | |
push: | |
tags: | |
- '*' | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
USE_CACHE: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.cache == 'true') || (github.event_name == 'pull_request') || (github.event_name == 'push') }} | |
DOCUMENTATION_CNAME: 'docs.pyvista.org' | |
PYDEVD_DISABLE_FILE_VALIDATION: '1' | |
jobs: | |
doc: | |
name: Build Documentation | |
runs-on: ubuntu-20.04 | |
env: | |
PYVISTA_OFF_SCREEN: 'True' | |
ALLOW_PLOTTING: true | |
SHELLOPTS: 'errexit:pipefail' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements.txt | |
requirements_docs.txt | |
- uses: awalsh128/[email protected] | |
with: | |
packages: libosmesa6-dev libgl1-mesa-dev python3-tk pandoc git-restore-mtime | |
version: 3.0 | |
- name: Install PyVista and dependencies | |
run: | | |
pip install -e . --no-deps | |
pip install -r requirements_docs.txt | |
- name: Install custom OSMesa VTK variant | |
run: | | |
pip uninstall vtk -y | |
aria2c -x5 "https://github.com/pyvista/pyvista-wheels/raw/main/${VTK_OSMESA_WHEEL_NAME}" | |
pip install "$VTK_OSMESA_WHEEL_NAME" | |
rm "$VTK_OSMESA_WHEEL_NAME" | |
env: | |
VTK_OSMESA_WHEEL_NAME: vtk_osmesa-9.2.5-cp311-cp311-linux_x86_64.whl | |
- name: PyVista Report | |
run: | | |
python -c "import pyvista;print(pyvista.Report())" | |
echo PYVISTA_EXAMPLE_DATA_PATH=$(python -c "from pyvista import examples; print(examples.USER_DATA_PATH)") >> $GITHUB_ENV | |
pip list | |
- name: Cache Sphinx-Gallery Examples | |
uses: actions/cache@v3 | |
if: env.USE_CACHE == 'true' && !startsWith(github.ref, 'refs/heads/release/') && !startsWith(github.ref, 'refs/tags/v') | |
with: | |
path: doc/source/examples/ | |
key: doc-examples-${{ hashFiles('pyvista/_version.py') }} | |
- name: Cache example data | |
uses: actions/cache@v3 | |
if: env.USE_CACHE == 'true' && !startsWith(github.ref, 'refs/heads/release/') && !startsWith(github.ref, 'refs/tags/v') | |
with: | |
path: ${{ env.PYVISTA_EXAMPLE_DATA_PATH }} | |
key: example-data-1-${{ hashFiles('pyvista/_version.py') }} | |
- name: Build Documentation | |
run: make -C doc html | |
- name: Copy ads.txt | |
run: cp doc/source/ads.txt doc/_build/html/ | |
- name: Dump Sphinx Warnings and Errors | |
if: always() | |
run: if [ -e doc/sphinx_warnings.txt ]; then cat doc/sphinx_warnings.txt; fi | |
- name: Dump VTK Warnings and Errors | |
if: always() | |
run: if [ -e doc/errors.txt ]; then cat doc/errors.txt; fi | |
- name: Preview HTML documentation | |
uses: nwtgck/[email protected] | |
with: | |
publish-dir: doc/_build/html/ | |
production-branch: main | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: "Deploy from GitHub Actions" | |
enable-pull-request-comment: true | |
enable-commit-comment: true | |
overwrites-pull-request-comment: true | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 10 | |
- name: Upload HTML documentation | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs-build | |
path: doc/_build/html/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: examples | |
path: doc/source/examples/ | |
- name: Get Notebooks | |
run: | | |
mkdir _notebooks | |
find doc/source/examples -type f -name '*.ipynb' | cpio -p -d -v _notebooks/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pyvista-notebooks | |
path: _notebooks | |
deploy: | |
name: Publish Documentation | |
runs-on: ubuntu-20.04 | |
needs: doc | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: docs-build | |
path: . | |
- name: Deploy Dev Docs | |
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') | |
uses: ansys/actions/doc-deploy-dev@v4 | |
with: | |
token: ${{ secrets.PYVISTA_BOT_TOKEN }} | |
decompress-artifact: false | |
repository: 'pyvista/pyvista-docs' | |
doc-artifact-name: docs-build | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
- name: Deploy Stable Docs | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
uses: ansys/actions/doc-deploy-stable@v4 | |
with: | |
token: ${{ secrets.PYVISTA_BOT_TOKEN }} | |
decompress-artifact: false | |
repository: 'pyvista/pyvista-docs' | |
doc-artifact-name: docs-build | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
publish-notebooks: | |
name: Publish Notebooks for MyBinder | |
runs-on: ubuntu-20.04 | |
needs: doc | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install Dependencies | |
run: | | |
pip install cookiecutter | |
- uses: actions/download-artifact@v3 | |
with: | |
name: pyvista-notebooks | |
path: . | |
- name: Make Cookiecutter | |
run: | | |
cookiecutter -f --no-input --config-file ./doc/source/pyvista-binder-config.yml https://github.com/pyvista/cookiecutter-pyvista-binder.git; | |
rm -rf ./pyvista-examples/notebooks/ | |
cp -r doc/source/examples/ ./pyvista-examples/ | |
ls -l ./pyvista-examples/ | |
- name: Publish notebooks on release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
external_repository: pyvista/pyvista-examples | |
personal_token: ${{ secrets.PYVISTA_BOT_TOKEN }} | |
publish_dir: pyvista-examples | |
publish_branch: master | |
exclude_assets: '' |