Merge pull request #18 from kggx/kggx/issue7 #35
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: | | |
python -m pip install --upgrade pip | |
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | |
- name: Build documentation HTML | |
run: pdoc ./src/pyventim -o ./public -d google | |
# Deploy the page to versioned pages | |
- name: Deploy to versioned pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
ssh-key: ${{ secrets.GH_PYVENTIM_PAGES }} | |
branch: gh-pages | |
folder: public/ | |
target-folder: ${{ env.version_path }} | |
clean: true | |
clean-exclude: '["version"]' |