Merge pull request #43 from apmoore1/license_error #49
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: Documentation-Check-Build-Deploy | |
| on: | |
| workflow_dispatch: # Manually trigger a workflow run using the GitHub API, GitHub CLI, or the GitHub UI. | |
| push: | |
| branches: | |
| - 'main' | |
| pull_request: | |
| branches: | |
| - 'main' | |
| permissions: | |
| contents: read # required to checkout repoistory | |
| jobs: | |
| doc-generated-check: | |
| name: Check that the Python API documentation reflects the code base. | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| id: setup-uv | |
| with: | |
| # Install a specific version of uv. | |
| version: "0.9.6" | |
| enable-cache: true | |
| restore-cache: true | |
| save-cache: true | |
| prune-cache: true | |
| cache-dependency-glob: "**/scripts/py2md.py.lock" | |
| - name: check uv cache is working | |
| if: steps.setup-uv.outputs.cache-hit == 'true' | |
| run: echo "uv cache was restored" | |
| - name: Check if the Python API documentation is up to date if not raise an error | |
| run: | | |
| make create-api-docs | |
| if [ $(git status -s | wc -l) -gt 0 ]; then echo "Need to run 'make create-api-docs' to generate the new Python API documentation and commit the documentation to the repository."; exit 1; fi | |
| doc-build-check-upload: | |
| name: Check documentation can build and if the main branch upload build | |
| runs-on: ubuntu-latest | |
| needs: doc-generated-check | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v5 | |
| - name: Enables corepack so that Yarn v4 is used | |
| run: corepack enable | |
| - name: Node JS | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: 'yarn' | |
| cache-dependency-path: './docs/yarn.lock' | |
| - name: Test Build | |
| working-directory: ./docs | |
| run: | | |
| yarn install --frozen-lockfile | |
| yarn build | |
| - name: Upload build | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: ./docs/build | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: doc-build-check-upload | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
| permissions: | |
| pages: write # to deploy to Pages | |
| id-token: write # to verify the deployment originates from an appropriate source | |
| # Deploy to the github-pages environment | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy pages to GitHub | |
| id: deployment | |
| uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action | |