diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 602fca8..4871b94 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -13,48 +13,89 @@ on: # yamllint disable-line rule:truthy - '.github/workflows/docs.yaml' workflow_dispatch: -permissions: read-all +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true -jobs: +permissions: + contents: read +jobs: build-docs: - runs-on: ubuntu-latest - timeout-minutes: 3 + name: Build Documentation + runs-on: ubuntu-slim + timeout-minutes: 5 + permissions: + contents: read steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false # Avoids exposing secrets to forks - name: Setup uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + with: + enable-cache: false # Disable caching to minimize storage usage - name: Install dependencies run: uv sync && uv pip install ./mule ./um_utils - name: Build mule docs - run: uv run make clean html --directory ./mule/docs - working-directory: ${{ github.workspace }} + run: uv run make clean html --directory "${GITHUB_WORKSPACE}/mule/docs" - name: Build um_utils docs - run: uv run make clean html --directory ./um_utils/docs - working-directory: ${{ github.workspace }} + run: uv run make clean html --directory "${GITHUB_WORKSPACE}/um_utils/docs" - # Deploy Steps + # Prepare landing page and copy built documentation to a temporary directory for upload - name: Copy Built Documentation - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + if: github.repository == 'MetOffice/mule' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' run: | mkdir _docs cp -r ./mule/docs/build/html _docs/mule cp -r ./um_utils/docs/build/html _docs/um_utils - echo '' > _docs/index.html + cat << 'EOF' > _docs/index.html + + + + + + Documentation Portal + + + +

Project Documentation

+ + + + EOF - name: Upload artifacts - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' - uses: actions/upload-pages-artifact@v4 + if: github.repository == 'MetOffice/mule' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 with: name: github-pages path: ./_docs @@ -63,25 +104,22 @@ jobs: if: always() run: uv cache prune --ci - # Deploy job + # Deploy to GitHub Pages only on main branch pushes to avoid deploying from forks or PRs deploy: - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' - - # Add a dependency to the build job + name: Publish to GitHub Pages + if: github.repository == 'MetOffice/mule' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' needs: build-docs + runs-on: ubuntu-slim + timeout-minutes: 5 permissions: - pages: write # to deploy to Pages - id-token: write # to verify the deployment originates from an appropriate source + 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 }} - # Specify runner + deployment step - runs-on: ubuntu-latest - steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index dfe0f41..e4db7a2 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -4,3 +4,4 @@ | ----------- | --------- | ----------- | ---- | | james-bruten-mo | James Bruten | Met Office | 2025-12-09 | | jennyhickson | Jenny Hickson | Met Office | 2026-03-02 | +| yaswant | Yaswant Pradhan | Met Office | 2026-05-22 |