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: docs_pages_workflow | |
on: | |
push: | |
branches: [ main ] # Triggers the workflow when pushing to the main branch | |
jobs: | |
build_docs_job: | |
runs-on: ubuntu-latest | |
permissions: # Set correct permissions for actions | |
contents: write # This allows pushing to branches | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 # Adjust this version as needed | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install sphinx sphinx-rtd-theme myst-parser furo | |
- name: Build Sphinx documentation | |
run: | | |
make -C docs clean # Clean previous builds | |
make -C docs html # Build HTML from Sphinx | |
ls | |
- name: Verify output files | |
run: | | |
ls docs/_build/html # List contents of the output directory | |
cat docs/_build/html/index.html # Display the first few lines of index.html | |
- name: Deploy to GitHub Pages | |
run: | | |
cd docs/_build/html # Navigate to the built HTML files | |
touch .nojekyll # Disable Jekyll to serve raw HTML/CSS | |
git init # Initialize a new Git repo in the build folder | |
git add . | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git commit -m "Deploy documentation to GitHub Pages" | |
git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | |
git push --force origin HEAD:gh-pages # Push from 'master' to 'gh-pages' |