-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (75 loc) · 2.47 KB
/
mkdocs.yml
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
name: ♻ mkdocs
on:
workflow_call:
inputs:
runs_on:
description: The label of the runner (GitHub- or self-hosted) to run this workflow on. Defaults to `ubuntu-24.04`.
type: string
required: false
default: ubuntu-24.04
python_version:
description: The version of Python to install.
type: string
required: false
default: latest
mkdocs_version:
description: The version of MkDocs to install using PIP.
type: string
required: false
default: ">=1.0.0"
requirements:
description: The path of a file containing the Python packages to install using PIP, usually "requirements.txt".
type: string
required: false
default: ""
artifact_name:
description: The name of the artifact to upload.
type: string
required: false
default: mkdocs
outputs:
artifact_name:
description: The name of the uploaded artifact containing the site.
value: ${{ inputs.artifact_name }}
permissions: {}
jobs:
mkdocs:
name: MkDocs
runs-on: ${{ inputs.runs_on }}
permissions:
contents: read # Required to checkout the repository
env:
SITE_DIR: site
ARTIFACT_NAME: ${{ inputs.artifact_name }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: ${{ inputs.python_version }}
- name: Install MkDocs
env:
MKDOCS_VERSION: ${{ inputs.mkdocs_version }}
run: |
python -m pip install --upgrade pip
pip install "mkdocs$MKDOCS_VERSION"
- name: Install dependencies
if: inputs.requirements != ''
env:
REQUIREMENTS: ${{ inputs.requirements }}
run: pip install -r "$REQUIREMENTS"
- name: MkDocs Build
run: mkdocs build --site-dir "$SITE_DIR"
- name: Create tarball
id: tar
working-directory: ${{ env.SITE_DIR }}
run: |
tarball="$RUNNER_TEMP/$ARTIFACT_NAME.tar"
tar -cvf "$tarball" .
echo "tarball=$tarball" >> "$GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: ${{ inputs.artifact_name }}
path: ${{ steps.tar.outputs.tarball }}