| 1 |
name: Publish documentation |
| 2 |
|
| 3 |
on: |
| 4 |
release: |
| 5 |
types: [published] |
| 6 |
workflow_dispatch: |
| 7 |
inputs: |
| 8 |
tag: |
| 9 |
description: 'Tag to build the documentation from (e.g. v5.1.0), defaults to the selected branch' |
| 10 |
required: false |
| 11 |
type: string |
| 12 |
|
| 13 |
permissions: |
| 14 |
contents: read |
| 15 |
|
| 16 |
# Never run two deployments at once, and let a running one finish instead of |
| 17 |
# cancelling it halfway through publishing. |
| 18 |
concurrency: |
| 19 |
group: pages |
| 20 |
cancel-in-progress: false |
| 21 |
|
| 22 |
jobs: |
| 23 |
build: |
| 24 |
runs-on: ubuntu-latest |
| 25 |
timeout-minutes: 10 |
| 26 |
|
| 27 |
steps: |
| 28 |
- uses: actions/checkout@v7 |
| 29 |
with: |
| 30 |
ref: ${{ inputs.tag || github.ref }} |
| 31 |
|
| 32 |
- name: Set up uv |
| 33 |
uses: astral-sh/[email protected] |
| 34 |
with: |
| 35 |
enable-cache: true |
| 36 |
|
| 37 |
- name: Install dependencies |
| 38 |
run: uv sync |
| 39 |
|
| 40 |
- name: Generate the documentation |
| 41 |
run: make docs |
| 42 |
|
| 43 |
- name: Keep the custom domain (osmapi.metaodi.ch) |
| 44 |
run: cp CNAME docs/CNAME |
| 45 |
|
| 46 |
- name: Upload the documentation as a Pages artifact |
| 47 |
uses: actions/upload-pages-artifact@v5 |
| 48 |
with: |
| 49 |
path: docs |
| 50 |
|
| 51 |
deploy: |
| 52 |
runs-on: ubuntu-latest |
| 53 |
needs: [build] |
| 54 |
permissions: |
| 55 |
pages: write |
| 56 |
id-token: write |
| 57 |
environment: |
| 58 |
name: github-pages |
| 59 |
url: ${{ steps.deployment.outputs.page_url }} |
| 60 |
|
| 61 |
steps: |
| 62 |
- name: Deploy to GitHub Pages |
| 63 |
id: deployment |
| 64 |
uses: actions/deploy-pages@v5 |