Skip to content

linting, minor refactoring #30

linting, minor refactoring

linting, minor refactoring #30

Workflow file for this run

name: Build and Deploy Documentation
on:
# Runs on pushes targeting the default branch (main or master)
push:
branches: ["main", "master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job: builds the documentation and uploads it as an artifact.
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: pip install -e .[docs]
- name: Build documentation
run: sphinx-build -b html docs/source docs/build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/build
# Deploy job for GitHub Pages
deploy-github:
needs: build
if: ${{ vars.IS_GITEA != 'true' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# Deploy job for Gitea
deploy-gitea:
needs: build
if: ${{ vars.IS_GITEA == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: github-pages # This is the default artifact name for upload-pages-artifact
path: ./docs-site
- name: Deploy to Gitea docs location
run: |
echo "Deploying documentation to Gitea's special directory..."
# The '/pages' directory is a mounted volume on the Gitea runner for serving static content.
sudo mkdir -p /pages/
sudo cp -r ./docs-site/* /pages/