Skip to content

Commit 84f0120

Browse files
Add doc generation to GH workflows (#122)
1 parent c855f9a commit 84f0120

File tree

4 files changed

+97
-0
lines changed

4 files changed

+97
-0
lines changed

.github/workflows/build-api.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,12 @@ jobs:
5858
with:
5959
user: __token__
6060
password: ${{ secrets.PYPI_API_TOKEN }}
61+
62+
docs:
63+
needs: [publish]
64+
uses: ./.github/workflows/build-docs.yml
65+
with:
66+
package_dir: 'livekit-api'
67+
docs_entrypoint: 'livekit-api/livekit/api'
68+
secrets: inherit
6169

.github/workflows/build-docs.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Build Docs
10+
11+
on:
12+
workflow_call:
13+
inputs:
14+
package_dir:
15+
required: true
16+
type: string
17+
docs_entrypoint:
18+
required: true
19+
type: string
20+
secrets:
21+
PYPI_API_TOKEN:
22+
required: true
23+
DOCS_DEPLOY_AWS_ACCESS_KEY:
24+
required: true
25+
DOCS_DEPLOY_AWS_API_SECRET:
26+
required: true
27+
28+
permissions:
29+
contents: read
30+
31+
jobs:
32+
docs:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
38+
- name: Generate Egg Info
39+
run: python ${{ inputs.package_dir }}/setup.py egg_info
40+
41+
- name: Find requires.txt
42+
run: |
43+
# Search for requirements.txt file and store its content in an environment variable
44+
REQUIREMENTS_FILE=$(find . -type f -name "requires.txt")
45+
echo "Found requires.txt file at: $REQUIREMENTS_FILE"
46+
47+
if [ -n "$REQUIREMENTS_FILE" ]; then
48+
echo "REQUIREMENTS_FILE=$REQUIREMENTS_FILE" >> $GITHUB_ENV
49+
else
50+
echo "No requiress.txt file found."
51+
fi
52+
53+
- name: Debug
54+
run: echo $REQUIREMENTS_FILE
55+
56+
- name: Install Requirements From Egg Info
57+
run: python -m pip install -r $REQUIREMENTS_FILE
58+
59+
- name: Install Package to Document
60+
run: python -m pip install -e ${{ inputs.package_dir }}
61+
62+
- name: Install pdoc
63+
run: python -m pip install --upgrade pdoc
64+
65+
- name: Build Docs
66+
run: python -m pdoc ${{ inputs.docs_entrypoint }} --docformat=google --output-dir docs
67+
68+
- name: S3 Upload
69+
run: aws s3 cp docs/ s3://livekit-docs/${{ inputs.package_dir }} --recursive
70+
env:
71+
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOY_AWS_ACCESS_KEY }}
72+
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_AWS_API_SECRET }}
73+
AWS_DEFAULT_REGION: "us-east-1"

.github/workflows/build-protocol.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,12 @@ jobs:
5858
with:
5959
user: __token__
6060
password: ${{ secrets.PYPI_API_TOKEN }}
61+
62+
docs:
63+
needs: [publish]
64+
uses: ./.github/workflows/build-docs.yml
65+
with:
66+
package_dir: 'livekit-protocol'
67+
docs_entrypoint: 'livekit-protocol/livekit/protocol'
68+
secrets: inherit
6169

.github/workflows/build-rtc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,11 @@ jobs:
8888
with:
8989
user: __token__
9090
password: ${{ secrets.PYPI_API_TOKEN }}
91+
92+
docs:
93+
needs: [publish]
94+
uses: ./.github/workflows/build-docs.yml
95+
with:
96+
package_dir: 'livekit-rtc'
97+
docs_entrypoint: 'livekit-rtc/livekit/rtc'
98+
secrets: inherit

0 commit comments

Comments
 (0)