74 lines (65 loc) · 2.12 KB
/
docs.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
name: Documentation
on:
push:
branches:
- main
paths:
- .github/workflows/docs.yml
- poetry.lock
- scripts/common.sh
- pywemo/**
permissions: {} # No permissions by default. Permissions are added per-job.
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
# NOTE: We use 3.10+ typing syntax via future, which pdoc only
# understands if it's actually run with Python 3.10 or newer.
python-version: ">= 3.10"
- name: Enable build input caching
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: |
./.cache/pip
./.cache/pypoetry
key: ${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: setup
env:
OUTPUT_ENV_VAR: GITHUB_OUTPUT
PIP_CACHE_DIR: ./.cache/pip
POETRY_CACHE_DIR: ./.cache/pypoetry
run: |
source ./scripts/common.sh
assertPython
enterVenv
poetryInstall
- name: build docs
run: |
source ./scripts/common.sh
enterVenv
pdoc -o ./html -d google ./pywemo/
- name: upload docs artifact
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0
with:
path: ./html/
# This is copied from the official `pdoc` example:
# https://github.com/mitmproxy/pdoc/blob/main/.github/workflows/docs.yml
#
# Deploy the artifact to GitHub pages.
# This is a separate job so that only actions/deploy-pages has the necessary permissions.
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
# NOTE: Needed to push to the repository.
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@7a9bd943aa5e5175aeb8502edcc6c1c02d398e10 # v4.0.2