Merge pull request #197 from COMP1010UNSW/dependabot/uv/pytest-9.0.3 #28
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: Generate documentation and deploy to GitHub pages | |
| on: | |
| # Documentation can be either manually updated or is automatically updated when pushed to main branch | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| # Make sure deploy-pages has necessary permissions to deploy to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Cancel older deploy workflow when more than one is running | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| name: Build and deploy documentation site | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} # Output URL after the workflow has finished | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| # Pinned Python version | |
| python-version-file: ".python-version" | |
| - run: uv sync --group docs | |
| # Build documentation to ./site/ directory | |
| - name: Build Documentation | |
| id: build | |
| run: uv run mkdocs build | |
| # Upload artifact from the ./site/ directory using the expected format for GitHub Pages | |
| - name: Upload Artifact | |
| id: upload | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: ./site/ | |
| # Use previously uploaded artifact to deploy to GitHub Pages | |
| - name: Deploy | |
| id: deploy | |
| uses: actions/deploy-pages@v5 |