Merge pull request #14 from kggx/kggx-patch-1 #28
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: 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@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: docs/ | |
target-folder: ${{ env.version_path }} | |
clean: true | |
clean-exclude: '["version"]' |