|
| 1 | +name: Generate Sphinx Documentation for pylibfranka |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + branches: |
| 8 | + - main |
| 9 | + - 'docs/**' |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + sphinx-docs: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + submodules: 'recursive' |
| 21 | + fetch-depth: 0 # Fetch all history including tags for version detection |
| 22 | + |
| 23 | + - name: Build Docker Image |
| 24 | + uses: docker/build-push-action@v4 |
| 25 | + with: |
| 26 | + context: . |
| 27 | + file: ./.devcontainer/Dockerfile |
| 28 | + tags: pylibfranka:latest |
| 29 | + push: false |
| 30 | + load: true |
| 31 | + |
| 32 | + - name: Setup Dependencies |
| 33 | + uses: addnab/docker-run-action@v3 |
| 34 | + with: |
| 35 | + image: pylibfranka:latest |
| 36 | + options: -v ${{ github.workspace }}:/workspace |
| 37 | + run: | |
| 38 | + cd /workspace/pylibfranka |
| 39 | + ./scripts/setup_dependencies.sh |
| 40 | +
|
| 41 | + - name: Build and Install pylibfranka and Generate Docs |
| 42 | + uses: addnab/docker-run-action@v3 |
| 43 | + with: |
| 44 | + image: pylibfranka:latest |
| 45 | + options: -v ${{ github.workspace }}:/workspace |
| 46 | + run: | |
| 47 | + cd /workspace |
| 48 | + export PATH="$HOME/.local/bin:$PATH" |
| 49 | + export LC_ALL=C.UTF-8 |
| 50 | + export LANG=C.UTF-8 |
| 51 | + |
| 52 | + # Install pylibfranka |
| 53 | + pip3 install . |
| 54 | + |
| 55 | + # Move to docs directory |
| 56 | + cd pylibfranka/docs |
| 57 | + |
| 58 | + # Install Sphinx requirements |
| 59 | + pip3 install -r requirements.txt --user |
| 60 | + |
| 61 | + # Get version from pylibfranka |
| 62 | + VERSION=$(python3 -c "import pylibfranka; print(pylibfranka.__version__)") |
| 63 | + echo "Building documentation for version: $VERSION" |
| 64 | + |
| 65 | + # Build documentation |
| 66 | + make clean |
| 67 | + make html |
| 68 | + |
| 69 | + # Prepare output directory with pylibfranka subfolder |
| 70 | + mkdir -p /workspace/docs_output/pylibfranka/${VERSION} |
| 71 | + cp -r _build/html/* /workspace/docs_output/pylibfranka/${VERSION}/ |
| 72 | +
|
| 73 | + - name: Deploy to GitHub Pages |
| 74 | + uses: peaceiris/actions-gh-pages@v3 |
| 75 | + with: |
| 76 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + publish_branch: gh-pages |
| 78 | + publish_dir: docs_output |
| 79 | + keep_files: true |
0 commit comments