updated #12
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: Deploy Docs to Netlify | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| cache: pip | |
| cache-dependency-path: requirements-docs.txt | |
| - name: Install dependencies | |
| run: pip install -r requirements-docs.txt | |
| - name: Generate Sphinx site | |
| run: | | |
| bash scripts/build_site.sh | |
| sphinx-build -b html docs site | |
| - name: Setup Node.js (for Netlify CLI) | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: lts/* | |
| - name: Install Netlify CLI | |
| run: npm install -g netlify-cli | |
| # Deploy preview for Pull Requests | |
| - name: Deploy preview to Netlify | |
| if: github.event_name == 'pull_request' | |
| run: netlify deploy --dir=site --message="PR ${{ github.event.number }} - Run ${{ github.run_number }}" | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| # Deploy to Production for Main branch pushes | |
| - name: Deploy to Netlify Production | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: netlify deploy --prod --dir=site --message="Deploy Main - Run ${{ github.run_number }}" | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |