Skip to content

Update docs.yml

Update docs.yml #21

Workflow file for this run

name: Documentation
on:
push:
branches: ["main"]
release:
types:
- published
env:
version_path: / # Path for docs. Default is latest
permissions:
contents: write
jobs:
#####################################
# Build and publish the documentation
#####################################
docs:
runs-on: ubuntu-latest
steps:
# Set environment variables for the pathes
- name: Update version_path for releases
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: echo version_path=/version/$(echo $GITHUB_REF | cut -d / -f 3 | cut -d v -f 2- | cut -d . -f 1,2)/ >> $GITHUB_ENV
- name: Update version_path for non-main branches
if: ${{ github.ref_type == 'branch' && github.ref_name != 'main'}}
run: echo version_path=/preview/ >> $GITHUB_ENV
# Checkout repo and build documentation
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dev module and requirements
run: pip install -r requirements-dev.txt
- name: Build documentation HTML
run: pdoc ./src/pyventim -o ./docs
# Deploy the page to versioned pages
- name: Deploy to versioned pages
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/
TARGET_FOLDER: ${{ env.version_path }}
CLEAN: true
CLEAN_EXCLUDE: '["version"]'