From d4aad2e2a8d6d0608fa49195967f4a667f5feeb5 Mon Sep 17 00:00:00 2001 From: Neil Dwyer Date: Tue, 12 Dec 2023 13:15:29 -0800 Subject: [PATCH] Add doc generation to GH workflows --- .github/workflows/build-api.yml | 8 +++ .github/workflows/build-docs.yml | 73 ++++++++++++++++++++++++++++ .github/workflows/build-protocol.yml | 8 +++ .github/workflows/build-rtc.yml | 8 +++ 4 files changed, 97 insertions(+) create mode 100644 .github/workflows/build-docs.yml diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml index 6ea87597..e88ddaa1 100644 --- a/.github/workflows/build-api.yml +++ b/.github/workflows/build-api.yml @@ -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 diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 00000000..f1f0d55a --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -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" \ No newline at end of file diff --git a/.github/workflows/build-protocol.yml b/.github/workflows/build-protocol.yml index b8eeaacc..228034fc 100644 --- a/.github/workflows/build-protocol.yml +++ b/.github/workflows/build-protocol.yml @@ -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 diff --git a/.github/workflows/build-rtc.yml b/.github/workflows/build-rtc.yml index 004142bd..2cdd39bf 100644 --- a/.github/workflows/build-rtc.yml +++ b/.github/workflows/build-rtc.yml @@ -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