Skip to content

Fix deploy docs action to preserve files #16

Fix deploy docs action to preserve files

Fix deploy docs action to preserve files #16

Workflow file for this run

name: Build and Deploy Docs
on:
push:
branches:
- main
- dev
tags:
- '*'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Ensures all history is fetched for sphinx-multiversion to detect all tags and branches
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Install Dependencies
run: |
pip install poetry
poetry install
- name: Build Docs with sphinx-multiversion
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
OUTDIR=docs/_build/html
else
BRANCH_NAME=$(echo ${{ github.ref }} | sed 's,refs/heads/,,; s,refs/tags/,,')
OUTDIR=docs/_build/html/${BRANCH_NAME}
fi
poetry run sphinx-multiversion docs $OUTDIR
- name: Prepare Deployment
run: |
touch ./docs/_build/html/.nojekyll
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
keep_files: true # Keeps existing files at deployment location