-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (81 loc) · 3.09 KB
/
python-deploy-docs.yml
File metadata and controls
94 lines (81 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Python Deploy Docs
# Publishes documentation for a python package to GitHub pages. Uses `mkdocs` for building documentation. Would commonly
# be one of two jobs along with with Python Release Workflow in a repo workflow triggered by e.g. tagging a version.
on:
workflow_call:
inputs:
python-version:
description: The python version to use
required: true
type: string
default: "3.10"
poetry-version:
description: The poetry version to use
required: false
type: string
default: "latest"
working-directory:
description: The working directory
required: false
type: string
default: .
timeout-minutes:
description: Maximum runtime in minutes
required: false
type: number
default: 10
optional-dependency-groups:
description: Which optional group or groups to install. Use comma delimiter for multiple groups e.g `dev,doc`.
required: false
type: string
default: dev
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.timeout-minutes }}
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- uses: actions/checkout@v5
- name: install_package
uses: GNS-Science/nshm-github-actions/.github/actions/python-install@main
with:
python-version: ${{ inputs.python-version }}
poetry-version: ${{ inputs.poetry-version }}
working-directory: ${{ inputs.working-directory }}
optional-dependency-groups: ${{ inputs.optional-dependency-groups }}
#----------------------------------------------
# build documentation
# - we must also ensure that the project itself is installed
#----------------------------------------------
- name: build documentation
run: |
poetry install --only-root
poetry run mkdocs build
#----------------------------------------------
# package and upload artifact for deployment to GitHub Pages
#----------------------------------------------
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: ${{ inputs.working-directory }}/site
#----------------------------------------------
# deploy page
#----------------------------------------------
- name: Deploy Docs to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4