Merge pull request #4 from melissawm/perma-docs #54
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 Deploy Docs | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
# Only allow one docs build at a time so that overlapping stale builds will get | |
# cancelled automatically. | |
concurrency: | |
group: deploy_docs | |
cancel-in-progress: true | |
jobs: | |
build-and-deploy: | |
name: Build & Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone docs repo | |
uses: actions/checkout@main | |
with: | |
path: docs # place in a named directory | |
- name: Clone main repo | |
uses: actions/checkout@main | |
with: | |
path: napari-repo | |
ref: main | |
repository: napari/napari | |
# ensure version metadata is proper | |
fetch-depth: 0 | |
- name: Copy examples to docs folder | |
run: | | |
cp -R napari-repo/examples docs | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- uses: tlambert03/setup-qt-libs@v1 | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install "napari-repo/[all]" -c "napari-repo/resources/constraints/constraints_py3.9.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@v1 | |
env: | |
GOOGLE_CALENDAR_ID: ${{ secrets.GOOGLE_CALENDAR_ID }} | |
GOOGLE_CALENDAR_API_KEY: ${{ secrets.GOOGLE_CALENDAR_API_KEY }} | |
with: | |
# the napari-docs repo is cloned into a docs/ folder, hence the | |
# invocation below. Locally, you should simply run make docs | |
run: make -C docs docs GALLERY_PATH=../examples/ | |
- name: Copy permanent files to appropriate folders | |
uses: nkoppel/push-files-to-another-repository@v1.1.1 | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source-files: 'docs/docs/_build/index.html, docs/docs/_build/developers' | |
destination-username: 'melissawm' | |
destination-branch: 'gh-pages' | |
destination-repository: 'melissawm/napari.github.io' | |
destination-directory: 'stable' | |
- name: Deploy Docs | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
external_repository: melissawm/napari.github.io | |
publish_dir: docs/docs/_build | |
publish_branch: gh-pages | |
destination_dir: dev | |
cname: napari.org |