update the link #17
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 and Deploy Docs | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install sphinx numpy | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi | |
| - name: Build docs | |
| run: | | |
| export PYTHONPATH="${GITHUB_WORKSPACE}" | |
| cd docs | |
| make html | |
| - name: Upload built docs artifact | |
| if: github.ref == 'refs/heads/develop' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs-html | |
| path: docs/build/html | |
| deploy: | |
| if: github.ref == 'refs/heads/main' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install sphinx numpy | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi | |
| - name: Build docs | |
| run: | | |
| export PYTHONPATH="${GITHUB_WORKSPACE}" | |
| cd docs | |
| make html | |
| - name: Deploy to gh-pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_branch: gh-pages | |
| publish_dir: docs/build/html |