Skip to content

Commit 395dd43

Browse files
Merge pull request #44 from GNS-Science/doc-default-group
- include doc in default groups when building docs, remove uv sync - test build docs
2 parents 226b2cc + e2d77e2 commit 395dd43

12 files changed

Lines changed: 819 additions & 17 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# A workflow that runs on push/PR to check that python-deploy-docs-uv.yml works
2+
3+
name: python-deploy-docs-uv test workflow
4+
5+
on:
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
# schedules this to run weekly
9+
# schedule:
10+
# - cron: '5 3 * * 0' # At 03:05 on Sunday
11+
push:
12+
branches: [main, pre-release]
13+
pull_request:
14+
branches: [main, pre-release]
15+
16+
jobs:
17+
call-test-workflow:
18+
uses: ./.github/workflows/python-deploy-docs-uv.yml
19+
with:
20+
python-version: "3.12"
21+
working-directory: samplePythonProjectUv
22+
build-only: true
23+
secrets: inherit
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# A workflow that is scheduled to run regularly in order to check that python-deploy-docs.yml works
2+
3+
name: python-deploy-docs test workflow
4+
5+
on:
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
# schedules this to run weekly
9+
# schedule:
10+
# - cron: '5 3 * * 0' # At 03:05 on Sunday
11+
push:
12+
branches: [main, pre-release]
13+
pull_request:
14+
branches: [main, pre-release]
15+
16+
jobs:
17+
call-test-workflow:
18+
uses: ./.github/workflows/python-deploy-docs.yml
19+
with:
20+
python-version: "3.12"
21+
working-directory: samplePythonProject
22+
build-only: true
23+
secrets: inherit

.github/workflows/python-deploy-docs-uv.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ on:
3030
description: Which optional group or groups to install. Use comma delimiter for multiple groups e.g `dev,doc`.
3131
required: false
3232
type: string
33-
default: dev
33+
default: dev,doc
34+
build-only:
35+
description: If true, skip the upload and deploy steps (useful for testing the build without deploying to GitHub Pages).
36+
required: false
37+
type: boolean
38+
default: false
3439

3540

3641
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
@@ -47,9 +52,7 @@ concurrency:
4752

4853
jobs:
4954
deploy:
50-
environment:
51-
name: github-pages
52-
url: ${{ steps.deployment.outputs.page_url }}
55+
environment: ${{ !inputs.build-only && 'github-pages' || '' }}
5356
runs-on: ubuntu-latest
5457
timeout-minutes: ${{ inputs.timeout-minutes }}
5558
defaults:
@@ -70,18 +73,16 @@ jobs:
7073

7174
#----------------------------------------------
7275
# build documentation
73-
# - uv sync installs the project root by default; the composite action
74-
# uses --no-install-project, so sync here to bring it in before building
7576
#----------------------------------------------
7677
- name: build documentation
7778
run: |
78-
uv sync
7979
uv run mkdocs build
8080
8181
#----------------------------------------------
8282
# package and upload artifact for deployment to GitHub Pages
8383
#----------------------------------------------
8484
- name: Upload artifact
85+
if: ${{ !inputs.build-only }}
8586
uses: actions/upload-pages-artifact@v4
8687
with:
8788
path: ${{ inputs.working-directory }}/site
@@ -91,5 +92,6 @@ jobs:
9192
# deploy page
9293
#----------------------------------------------
9394
- name: Deploy Docs to GitHub Pages
95+
if: ${{ !inputs.build-only }}
9496
id: deployment
9597
uses: actions/deploy-pages@v4

.github/workflows/python-deploy-docs.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ on:
3030
description: Which optional group or groups to install. Use comma delimiter for multiple groups e.g `dev,doc`.
3131
required: false
3232
type: string
33-
default: dev
33+
default: dev,doc
34+
build-only:
35+
description: If true, skip the upload and deploy steps (useful for testing the build without deploying to GitHub Pages).
36+
required: false
37+
type: boolean
38+
default: false
3439

3540

3641
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
@@ -47,9 +52,7 @@ concurrency:
4752

4853
jobs:
4954
deploy:
50-
environment:
51-
name: github-pages
52-
url: ${{ steps.deployment.outputs.page_url }}
55+
environment: ${{ !inputs.build-only && 'github-pages' || '' }}
5356
runs-on: ubuntu-latest
5457
timeout-minutes: ${{ inputs.timeout-minutes }}
5558
defaults:
@@ -78,9 +81,10 @@ jobs:
7881
poetry run mkdocs build
7982
8083
#----------------------------------------------
81-
# package and upload artifact for deployment to GitHub Pages
84+
# package and upload artifact for deployment to GitHub Pages
8285
#----------------------------------------------
8386
- name: Upload artifact
87+
if: ${{ !inputs.build-only }}
8488
uses: actions/upload-pages-artifact@v4
8589
with:
8690
path: ${{ inputs.working-directory }}/site
@@ -90,5 +94,6 @@ jobs:
9094
# deploy page
9195
#----------------------------------------------
9296
- name: Deploy Docs to GitHub Pages
97+
if: ${{ !inputs.build-only }}
9398
id: deployment
9499
uses: actions/deploy-pages@v4

samplePythonProject/docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# theproject
2+
3+
Sample project documentation.

samplePythonProject/mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
site_name: theproject
2+
docs_dir: docs

0 commit comments

Comments
 (0)