Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/build-dev-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build dev-docs (mkdocs)

on:
workflow_call:
inputs:
python-version:
description: "Python version used to build the dev docs."
required: false
default: "3.10"
type: string

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}

- name: Install system dependencies for mkdocs-material social plugin
run: |
sudo apt-get update -qq
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev \
libjpeg-dev libpng-dev libz-dev

- name: Install dev-docs dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev-docs]"

- name: Build dev docs
run: mkdocs build -v -f dev-docs/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build (and optionally deploy) Jupyter Book
name: Build main docs (Jupyter Book)

on:
workflow_call:
Expand All @@ -18,8 +18,6 @@ on:
default: false
type: boolean



jobs:
build:
runs-on: ubuntu-latest
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/deploy-docs.yml
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to have concurrency guards in anything that deploys to gh-pages

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed! As long as we don't overcomplicate things.

I am more worried about subsequent pushes that trigger the latest-doc build than race conditions between main-docs and dev-docs as they write to independent output dirs

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy docs (main + dev-docs latest)

on:
push:
branches: [ main ]

permissions:
contents: write

jobs:
build:
uses: ./.github/workflows/build-main-docs.yml
with:
python-version: "3.10"
build_dir: "./_build/html"
upload_artifact: true
secrets: inherit

deploy-main-docs:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download built Jupyter Book artifact
uses: actions/download-artifact@v4
with:
name: built-book
path: site

- name: Deploy main docs to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site
keep_files: true # preserve /dev/ versions managed by mike

deploy-dev-docs-latest:
needs: deploy-main-docs
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # mike needs full history to read/write gh-pages branch

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"

- name: Install system dependencies for mkdocs-material social plugin
run: |
sudo apt-get update -qq
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev \
libjpeg-dev libpng-dev libz-dev

- name: Install dev-docs dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev-docs]"

- name: Configure git for mike
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the bot need special permissions ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, we need to add permissions for pushing to the gh-pages branch


- name: Deploy latest dev-docs with mike (main branch)
run: |
mike deploy --push \
--config-file dev-docs/mkdocs.yml \
--deploy-prefix dev \
main
mike set-default --push \
--config-file dev-docs/mkdocs.yml \
--deploy-prefix dev \
main
13 changes: 11 additions & 2 deletions .github/workflows/intelligent-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,25 @@ jobs:


docs:
name: Docs build
name: Main docs build
needs: intelligent-test-selection
if: needs.intelligent-test-selection.outputs.run_docs == 'true'
uses: ./.github/workflows/build-book.yml
uses: ./.github/workflows/build-main-docs.yml
with:
python-version: "3.10"
build_dir: "./_build/html"
upload_artifact: false
secrets: inherit

dev-docs:
name: Dev docs build
needs: intelligent-test-selection
if: needs.intelligent-test-selection.outputs.run_docs == 'true'
uses: ./.github/workflows/build-dev-docs.yml
with:
python-version: "3.10"
secrets: inherit


fast-tests:
name: Fast lane (targeted pytest + selected functional)
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/manage-dev-docs.yml
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we somehow avoid duplicates?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the deploy one

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes good suggestion, this is duplicated now indeed

Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Manage dev-docs versions (manual)

on:
workflow_dispatch:
inputs:
action:
description: "Action to perform"
required: true
type: choice
options:
- deploy-version
- delete-version
version_label:
description: "Version label to deploy or delete (e.g. 3.0)"
required: true
type: string
git_tag:
description: "Git tag to check out for deploy-version (e.g. v3.0.0rc14). Ignored for delete-version."
required: false
type: string

permissions:
contents: write

jobs:
deploy-version:
if: ${{ inputs.action == 'deploy-version' }}
runs-on: ubuntu-latest
steps:
- name: Validate inputs
run: |
if [ -z "${{ inputs.git_tag }}" ]; then
echo "::error::git_tag is required for deploy-version"
exit 1
fi

- uses: actions/checkout@v6
with:
fetch-depth: 0 # mike needs full history to read/write gh-pages branch

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"

- name: Install system dependencies for mkdocs-material social plugin
run: |
sudo apt-get update -qq
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev \
libjpeg-dev libpng-dev libz-dev

- name: Check out tagged source tree
run: git checkout "${{ inputs.git_tag }}" -- deeplabcut

- name: Install dev-docs dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev-docs]"

- name: Configure git for mike
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Deploy version with mike
run: |
mike deploy --push \
--config-file dev-docs/mkdocs.yml \
--deploy-prefix dev \
"${{ inputs.version_label }}"

delete-version:
if: ${{ inputs.action == 'delete-version' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # mike needs full history to read/write gh-pages branch

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"

- name: Install dev-docs dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev-docs]"

- name: Configure git for mike
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Delete version with mike
run: |
mike delete --push \
--config-file dev-docs/mkdocs.yml \
--deploy-prefix dev \
"${{ inputs.version_label }}"
35 changes: 0 additions & 35 deletions .github/workflows/publish-book.yml

This file was deleted.

5 changes: 5 additions & 0 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ parts:
- file: docs/benchmark
- file: docs/recipes/TechHardware

- caption: Development
chapters:
- file: docs/dev
title: Developer Documentation

- caption: Additional guides (Recipes)
chapters:
- file: docs/recipes/index
Expand Down
Binary file added dev-docs/docs/assets/favicon.ico
Binary file not shown.
Empty file.
Binary file added dev-docs/docs/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Loading
Loading