Deploy Documentation #18
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: 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: Get branch name | ||
id: get-branch | ||
run: echo "branch=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT | ||
- name: Build documentation | ||
env: | ||
READTHEDOCS_VERSION: ${{ steps.get-branch.outputs.branch != 'main' && 'releases/' + steps.get-branch.outputs.branch || 'main' }} | ||
Check failure on line 44 in .github/workflows/deploy-docs.yaml GitHub Actions / Deploy DocumentationInvalid workflow file
|
||
run: make develop | ||
- 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 |