Docs clean homepage #39
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
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| name: Preview Documentation | |
| jobs: | |
| render-docs-preview-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| deployments: write | |
| pull-requests: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Quarto | |
| uses: quarto-dev/quarto-actions/setup@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[docs] | |
| - name: quartodoc build | |
| run: | | |
| quartodoc build | |
| - name: Render Quarto Project | |
| run: | | |
| quarto render | |
| # ===================================================== | |
| # Deploy to Netlify | |
| # ===================================================== | |
| # Create a unique name for this deployment using the PR number | |
| # This helps track which PR preview is which | |
| - name: Configure release name | |
| run: echo "RELEASE_NAME=pr-${{ github.event.number }}" >> $GITHUB_ENV | |
| # Create a deployment status on GitHub to track the deployment progress | |
| # This shows up in the PR's "Deployments" section | |
| - name: Create deployment status | |
| uses: bobheadxi/deployments@v1 | |
| id: deployment | |
| with: | |
| step: start | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| env: github-pages | |
| logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' | |
| # Deploy the rendered site to Netlify with a PR-specific preview URL | |
| # The alias ensures each PR gets its own stable URL during review | |
| - name: Deploy to Netlify | |
| id: netlify | |
| env: | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| run: | | |
| npm install -g netlify-cli | |
| netlify deploy --dir=_site/ --alias="pr-${{ github.event.number }}" 2>&1 | tee deploy.log | |
| DEPLOY_URL=$(grep -oP 'https://[^\s]+' deploy.log | grep -E '(netlify\.app|--.*\.netlify\.app)' | head -n 1) | |
| echo "url=${DEPLOY_URL}" >> $GITHUB_OUTPUT | |
| # Update the GitHub deployment status with success/failure and the preview URL | |
| # This creates a clickable link in the PR to view the deployed preview | |
| - name: Update deployment status | |
| uses: bobheadxi/deployments@v1 | |
| if: ${{ always() && steps.deployment.outputs.deployment_id != '' }} | |
| with: | |
| step: finish | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| status: ${{ job.status }} | |
| deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
| env: github-pages | |
| env_url: ${{ steps.netlify.outputs.url }} | |
| logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' |