Skip to content

Merge livekit-agent 0.9.0 (#4) #3

Merge livekit-agent 0.9.0 (#4)

Merge livekit-agent 0.9.0 (#4) #3

# 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: Release and publish
on:
workflow_dispatch:
push:
branches:
- main
- dev
jobs:
bump:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.changesets.outputs.publishedPackages }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
lfs: true
env:
GITHUB_TOKEN: ${{ secrets.CHANGESETS_PUSH_PAT }}
- uses: pnpm/action-setup@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install pnpm dependencies
run: pnpm install
- name: Ensure release mode
id: release_mode
run: |
set +e
pnpm changeset pre ${{ github.ref == 'refs/heads/main' && 'exit' || 'enter dev' }}
echo "exitcode=$?" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add changes
if: ${{ steps.release_mode.outputs.exitcode == '0' }}
uses: EndBug/add-and-commit@v9
with:
add: '[".changeset"]'
default_author: github_actions
message: ${{ github.ref == 'refs/heads/main' && 'Exit' || 'Enter dev' }} pre release mode
- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
with:
version: pnpm ci:version
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: debug packages
run: echo "${{ steps.changesets.outputs.publishedPackages }}"
build:
needs:
- bump
if: ${{ fromJson(needs.bump.outputs.packages)[0] != null }}
strategy:
matrix:
package: ${{ fromJson(needs.bump.outputs.packages) }}
uses: livekit/agents/.github/workflows/build-package.yml@main
with:
package: ${{ matrix.package.name }}
artifact_name: python-package-distributions
publish:
needs:
- build
- bump
if: ${{ fromJson(needs.bump.outputs.packages)[0] != null }}
runs-on: ubuntu-latest
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
docs:
if: ${{ fromJson(needs.bump.outputs.packages)[0] != null }}
needs:
- bump
- publish
strategy:
matrix:
package: ${{ fromJSON(needs.bump.outputs.packages) }}
runs-on: ubuntu-latest
env:
package: ${{ matrix.package.name }}
module: $(echo "${{ startsWith(matrix.package.name, 'livekit-plugin') && 'livekit-plugins/' || '' }}${{ matrix.package.name }}" | tr '-' '/')
steps:
- uses: actions/checkout@v4
with:
submodules: true
lfs: true
- name: Install pdoc
run: python -m pip install --upgrade pdoc
- name: Install package
run: python -m pip install $package/
- name: Build Docs
run: python -m pdoc $module --docformat=google --output-dir docs
- name: S3 Upload
run: aws s3 cp docs/ s3://livekit-docs/$package --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"