feat: strip dir prefixes #814
Workflow file for this run
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: CI Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| build-docs: | |
| name: "Build Docs" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Full history for accurate page timestamps | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e . | |
| python -m pip install jupyter | |
| - name: Set up Quarto | |
| uses: quarto-dev/quarto-actions/setup@v2 | |
| - name: Build docs | |
| run: great-docs build | |
| - name: Save docs artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: docs-html | |
| path: great-docs/_site | |
| publish-docs: | |
| name: "Publish Docs" | |
| runs-on: ubuntu-latest | |
| needs: "build-docs" | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| name: docs-html | |
| path: great-docs/_site | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: great-docs/_site | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 | |
| preview-docs: | |
| name: "Preview Docs" | |
| runs-on: ubuntu-latest | |
| needs: "build-docs" | |
| if: github.event_name == 'pull_request' | |
| permissions: | |
| deployments: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| name: docs-html | |
| path: great-docs/_site | |
| # Start deployment | |
| - name: Configure pull release name | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: | | |
| echo "RELEASE_NAME=pr-${PR_NUMBER}" >> $GITHUB_ENV | |
| env: | |
| PR_NUMBER: ${{ github.event.number }} | |
| - name: Configure branch release name | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| # use branch name, but replace slashes. E.g. feat/a -> feat-a | |
| echo "RELEASE_NAME=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV | |
| # Deploy | |
| - name: Create Github Deployment | |
| uses: bobheadxi/deployments@v1 | |
| id: deployment | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| with: | |
| step: start | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| env: ${{ env.RELEASE_NAME }} | |
| ref: ${{ github.head_ref }} | |
| logs: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" |