Skip to content

release: 0.21.1. fix package version #38

release: 0.21.1. fix package version

release: 0.21.1. fix package version #38

name: Generate Sphinx Documentation for pylibfranka
on:
push:
tags:
- '*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/pylibfranka-build
jobs:
sphinx-docs:
runs-on: ubuntu-latest
permissions:
contents: write
packages: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0 # Fetch all history including tags for version detection
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull pre-built Docker image
run: |
echo "Pulling pre-built image..."
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:py3.10
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:py3.10 pylibfranka:latest
- name: Setup Dependencies
uses: addnab/docker-run-action@v3
with:
image: pylibfranka:latest
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace/pylibfranka
./scripts/setup_dependencies.sh
- name: Build and Install pylibfranka and Generate Docs
uses: addnab/docker-run-action@v3
with:
image: pylibfranka:latest
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace
export PATH="$HOME/.local/bin:$PATH"
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
# Install pylibfranka
pip3 install .
# Move to docs directory
cd pylibfranka/docs
# Install Sphinx requirements
pip3 install -r requirements.txt
# Get version from installed package (synced from CMakeLists.txt)
VERSION=$(python3 -c "import pylibfranka; print(pylibfranka.__version__)")
echo "Building documentation for version: $VERSION"
# Build documentation
make clean
make html
# Prepare output directory with pylibfranka subfolder
mkdir -p /workspace/docs_output/pylibfranka/${VERSION}
cp -r _build/html/* /workspace/docs_output/pylibfranka/${VERSION}/
# Also copy to 'latest' directory for easy access
mkdir -p /workspace/docs_output/pylibfranka/latest
cp -r _build/html/* /workspace/docs_output/pylibfranka/latest/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: docs_output
keep_files: true