Skip to content

update docment base url (#477) #17

update docment base url (#477)

update docment base url (#477) #17

Workflow file for this run

name: Deploy Documentation
on:
push:
branches:
- main
workflow_dispatch:
inputs:
branch:
description: 'Enter branch name to deploy from (default: main)'
required: false
type: string
default: 'main'
jobs:
deploy-docs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: doc
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || 'main' }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Sphinx and dependencies
run: |
sudo apt-get install python3-sphinx
pip install -r requirements-doc.txt
pip install -r ../python/requirements.txt
- name: Build documentation
run: make develop
- name: Get branch name
id: get-branch
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
- name: Prepare deployment directory
run: |
# Create the branch-specific directory (e.g., deploy/main)
mkdir -p ../deploy/${{ steps.get-branch.outputs.branch }}
rsync -av _build/html/ ../deploy/${{ steps.get-branch.outputs.branch }}/
# Create symlinks from root to the main directory (only for the main branch)
if [ "${{ steps.get-branch.outputs.branch }}" = "main" ]; then
cd ../deploy
ln -sfn main/* . # Symlink all files/dirs from main/ to root
ln -sfn main/.nojekyll . # Include hidden files if needed
fi
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
keep_files: true