Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 67 additions & 29 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<ul style="font-size: 24px; padding: 50px;">
<li><a href="mule/index.html">Mule Documentation</a></li>
<li><a href="um_utils/index.html">UM Utils Documentation</a></li>
</ul>' > _docs/index.html
cat << 'EOF' > _docs/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Documentation Portal</title>
<style>
body {
font-family: "Segoe UI", Roboto, Helvetica, sans-serif;
background: #f8fafc;
color: #0f172a;
max-width: 600px;
margin: 60px auto;
padding: 0 20px;
}
h1 { border-bottom: 2px solid #e2e8f0; padding-bottom: 12px; margin-bottom: 24px; }
ul { list-style: none; padding: 0; }
li { margin-bottom: 12px; }
a {
display: block; padding: 14px; background: #fff;
border: 1px solid #e2e8f0; border-radius: 6px;
text-decoration: none; color: #2563eb; font-weight: 500;
}
a:hover { border-color: #2563eb; background: #f0fdf4; }
</style>
</head>
<body>
<h1>Project Documentation</h1>
<ul>
<li><a href="mule/index.html">📦 Mule API Documentation →</a></li>
<li><a href="um_utils/index.html">🛠️ UM Utilities Documentation →</a></li>
</ul>
</body>
</html>
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
Expand All @@ -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
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Loading