Merge pull request #12 from MatchCake/dev #5
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: Docs | |
| on: | |
| push: | |
| branches: ["main"] | |
| jobs: | |
| Build-Docs: | |
| name: Build docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.10" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: "0.9.2" | |
| python-version: "3.10" | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv venv .venv | |
| uv sync --locked --dev --group docs --extra cpu | |
| - name: Build the sphinx docs | |
| run: | | |
| uv run sphinx-apidoc -f -o ./sphinx/source ./src/matchcake_opt | |
| uv run make -C sphinx clean | |
| uv run python sphinx/clean_html_files.py | |
| uv run make -C sphinx html | |
| touch sphinx/build/html/.nojekyll | |
| - name: Checkout gh-pages branch | |
| run: | | |
| git checkout -b gh-pages | |
| git init | |
| - name: Copy build files to docs folder | |
| run: | | |
| cp -a sphinx/build/html/. docs/ | |
| uv run python sphinx/make_html_files_list.py | |
| rm -rf sphinx/build | |
| - name: Commit to gh-pages branch | |
| run: | | |
| git add -f docs | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git commit -m "Update docs" | |
| - name: Push to gh-pages branch | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{secrets.GITHUB_TOKEN}} | |
| branch: gh-pages | |
| force: true | |
| directory: docs |