Skip to content

Unify docs workflows #4

Unify docs workflows

Unify docs workflows #4

# As much as possible, this file should be kept in sync with
# https://github.com/napari/napari/blob/main/.github/workflows/build_docs.yml
name: Build PR Docs
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-upload:
name: Build & Upload Artifact
runs-on: ubuntu-latest
steps:
- name: Clone docs repo
uses: actions/checkout@v4
with:
path: docs # place in a named directory
- name: Clone main repo
uses: actions/checkout@v4
with:
path: napari # place in a named directory
repository: napari/napari
# ensure version metadata is proper
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache-dependency-path: |
napari/setup.cfg
docs/requirements.txt
- uses: tlambert03/setup-qt-libs@v1
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "napari/[all]"
env:
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.10_docs.txt
- name: Testing
run: |
python -c 'import napari; print(napari.__version__)'
python -c 'import napari.layers; print(napari.layers.__doc__)'
- name: Build Docs
uses: aganders3/headless-gui@v2
env:
GOOGLE_CALENDAR_ID: ${{ secrets.GOOGLE_CALENDAR_ID }}
GOOGLE_CALENDAR_API_KEY: ${{ secrets.GOOGLE_CALENDAR_API_KEY }}
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.10_docs.txt
with:
run: make -C docs docs
# skipping setup stops the action from running the default (tiling) window manager
# the window manager is not necessary for docs builds at this time and it was causing
# problems with screenshots (https://github.com/napari/docs/issues/285)
linux-setup: "echo 'skip setup'"
linux-teardown: "echo 'skip teardown'"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: docs
path: docs/docs/_build/html
deploy:
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main'))
name: Build & Upload Artifact
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: docs
path: docs
- name: get directory name
# if this is a tag, use the tag name as the directory name else dev
run: |

Check failure on line 92 in .github/workflows/build_and_deploy.yml

View workflow run for this annotation

GitHub Actions / Build PR Docs

Invalid workflow file

The workflow is not valid. .github/workflows/build_and_deploy.yml (Line: 92, Col: 14): Unexpected symbol: 'ref\/refs\/tags\//'. Located at position 8 within expression: github.ref\/refs\/tags\//
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
echo "branch_name=${{ github.ref\/refs\/tags\// }}" >> $GITHUB_ENV
else
echo "branch_name=dev" >> $GITHUB_ENV
fi
- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: napari/napari.github.io
publish_dir: docs/docs/_build/html
publish_branch: gh-pages
destination_dir: ${{ env.branch_name }}
cname: napari.org