Bump actions/checkout from 3 to 4 #5
Workflow file for this run
This file contains hidden or 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: Build Sphinx Documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - 2-add-continuous-integration | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest # You can also use `windows-latest` or `macos-latest` if needed | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' # Set your preferred Python version | |
| - name: Add contourusv to PYTHONPATH | |
| run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/contourusv" >> $GITHUB_ENV | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install sphinx sphinx_rtd_theme opencv-python numpy pandas tqdm scipy matplotlib codecarbon scikit-learn | |
| - name: Build the documentation | |
| run: | | |
| # Create a new branch for the documentation | |
| git checkout --orphan gh-pages | |
| # Generate reStructuredText files from the source code | |
| sphinx-apidoc -o sphinx/ contourusv/ -f | |
| rm -rf docs/ | |
| # Ensure the docs directory exists | |
| mkdir -p docs | |
| # Build the HTML documentation | |
| sphinx-build -b html sphinx/ docs/ | |
| pwd | |
| ls | |
| # Add a .nojekyll file to bypass Jekyll processing on GitHub Pages | |
| touch ./docs/.nojekyll | |
| - name: Commit and push generated docs | |
| run: | | |
| ls | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "Dallas Wade" | |
| git config --global pull.rebase false # Or true, or --ff-only based on your preference | |
| # Ensure docs/ is staged properly | |
| git add docs/ | |
| git status # Debugging: See if anything is staged | |
| git commit -m "Update Sphinx documentation" || echo "No changes to commit." | |
| # Push the changes | |
| git push origin gh-pages --force | |