Skip to content

Commit

Permalink
Add doc generation to GH workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
keepingitneil committed Dec 12, 2023
1 parent c855f9a commit d4aad2e
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,12 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

docs:
needs: [publish]
uses: ./.github/workflows/build-docs.yml
with:
package_dir: 'livekit-api'
docs_entrypoint: 'livekit-api/livekit/api'
secrets: inherit

73 changes: 73 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Build Docs

on:
workflow_call:
inputs:
package_dir:
required: true
type: string
docs_entrypoint:
required: true
type: string
secrets:
PYPI_API_TOKEN:
required: true
DOCS_DEPLOY_AWS_ACCESS_KEY:
required: true
DOCS_DEPLOY_AWS_API_SECRET:
required: true

permissions:
contents: read

jobs:
docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Generate Egg Info
run: python ${{ inputs.package_dir }}/setup.py egg_info

- name: Find requires.txt
run: |
# Search for requirements.txt file and store its content in an environment variable
REQUIREMENTS_FILE=$(find . -type f -name "requires.txt")
echo "Found requires.txt file at: $REQUIREMENTS_FILE"
if [ -n "$REQUIREMENTS_FILE" ]; then
echo "REQUIREMENTS_FILE=$REQUIREMENTS_FILE" >> $GITHUB_ENV
else
echo "No requiress.txt file found."
fi
- name: Debug
run: echo $REQUIREMENTS_FILE

- name: Install Requirements From Egg Info
run: python -m pip install -r $REQUIREMENTS_FILE

- name: Install Package to Document
run: python -m pip install -e ${{ inputs.package_dir }}

- name: Install pdoc
run: python -m pip install --upgrade pdoc

- name: Build Docs
run: python -m pdoc ${{ inputs.docs_entrypoint }} --docformat=google --output-dir docs

- name: S3 Upload
run: aws s3 cp docs/ s3://livekit-docs/${{ inputs.package_dir }} --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOY_AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_AWS_API_SECRET }}
AWS_DEFAULT_REGION: "us-east-1"
8 changes: 8 additions & 0 deletions .github/workflows/build-protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,12 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

docs:
needs: [publish]
uses: ./.github/workflows/build-docs.yml
with:
package_dir: 'livekit-protocol'
docs_entrypoint: 'livekit-protocol/livekit/protocol'
secrets: inherit

8 changes: 8 additions & 0 deletions .github/workflows/build-rtc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,11 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

docs:
needs: [publish]
uses: ./.github/workflows/build-docs.yml
with:
package_dir: 'livekit-rtc'
docs_entrypoint: 'livekit-rtc/livekit/rtc'
secrets: inherit

0 comments on commit d4aad2e

Please sign in to comment.