Skip to content

πŸ“š Documentation #17

πŸ“š Documentation

πŸ“š Documentation #17

Workflow file for this run

name: "πŸ“š Documentation"
# Global environment variables
env:
CONDITION_IS_PUSH: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') }}
CONDITION_IS_WORKFLOW_RUN: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }}
PROJECT_FOLDER: plugin_map2loop
PYTHON_VERSION: 3.12
# This workflow is triggered on:
on:
push:
branches:
- main
paths:
- '.github/workflows/documentation.yml'
- 'docs/**/*'
- "plugin_map2loop/**/*.py"
- "plugin_map2loop/metadata.txt"
- 'requirements/documentation.txt'
tags:
- "*"
pull_request:
branches:
- main
paths:
- ".github/workflows/documentation.yml"
- docs/**/*
- requirements/documentation.txt
workflow_dispatch:
workflow_run:
workflows:
- "πŸ“¦ Package & πŸš€ Release"
types:
- completed
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
id-token: write
pages: write
# Allow one concurrent deployment per branch/pr
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get source code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: "pip"
cache-dependency-path: "requirements/documentation.txt"
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache Sphinx cache
uses: actions/cache@v4
with:
path: docs/_build/cache
key: ${{ runner.os }}-sphinx-${{ hashFiles('docs/**/*') }}
restore-keys: |
${{ runner.os }}-sphinx-
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/documentation.txt
- name: Build doc using Sphinx
run: sphinx-build -b html -j auto -d docs/_build/cache -q docs docs/_build/html
- name: Download artifact from build workflow
if: ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
uses: dawidd6/action-download-artifact@v11
with:
allow_forks: false
branch: main
event: push
github_token: ${{ secrets.GITHUB_TOKEN }}
if_no_artifact_found: warn
name: ${{ env.PROJECT_FOLDER }}-latest
path: docs/_build/html/
# run_id: ${{ github.event.workflow_run.id }}
workflow: package_and_release.yml
- name: Save build doc as artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: documentation
path: docs/_build/html/*
retention-days: 30
- name: Setup Pages
uses: actions/configure-pages@v5
if: ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
if: ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
with:
# Upload entire repository
path: docs/_build/html/
- name: Deploy to GitHub Pages
id: deployment
if: ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
uses: actions/deploy-pages@v4