Skip to content

switched to pydata_sphinx_theme #16

switched to pydata_sphinx_theme

switched to pydata_sphinx_theme #16

Workflow file for this run

name: Build Docs
on:
push:
branches:
- '*'
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set OUTPUT_FOLDER
id: branch_name
run: |
OUTPUT_FOLDER="docs/_build"
echo "OUTPUT_FOLDER=${OUTPUT_FOLDER}" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8 # Change this to your desired Python version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build Documentation for all branches
run: |
# Get array of all branches in origin
branches=($(git ls-remote --heads origin | cut -f2 | cut -d'/' -f3))
# iterate over all branches
for branch in "${branches[@]}"; do
# Print branch name
echo "Building documentation for: $branch"
# Fetch and checkout branch
git fetch origin $branch
git checkout $branch
# main branch gets built in the root folder
if [ "$branch" == "main" ]; then
sphinx-build -b html source "${OUTPUT_FOLDER}"
else
# Every other branch gets built in a subfolder
mkdir -p "${OUTPUT_FOLDER}/$branch"
sphinx-build -b html source "${OUTPUT_FOLDER}/$branch"
fi
done
# Create .nojekyll file to prevent GitHub Pages from ignoring files/folders starting with an underscore
touch "${OUTPUT_FOLDER}/.nojekyll"
# echo "::set-output name=docs_folder::${OUTPUT_FOLDER}" # Set output for deploy job
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: ${{ env.OUTPUT_FOLDER}}
deploy:
environment:
name: github-pages
url: ${{ steps.build.outputs.url }}
runs-on: ubuntu-latest
needs: build
steps:
# Deploy to GitHub Pages while maintaining the previous deployment
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages