Skip to content

Commit

Permalink
Fix module name usage in action (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO authored Jul 23, 2024
1 parent c21c4ff commit f4afceb
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 96 deletions.
180 changes: 86 additions & 94 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,101 +63,93 @@ jobs:
- name: debug packages
run: echo "${{ steps.changesets.outputs.publishedPackages }}"

debug-outputs:
build:
needs:
- bump
strategy:
matrix:
package: ${{ fromJson(needs.bump.outputs.packages) }}
defaults:
run:
working-directory: "${{ startsWith(matrix.package.name, 'livekit-plugin') && 'livekit-plugins/' || '' }}${{ matrix.package.name }}"

runs-on: ubuntu-latest

steps:
- name: Echo outputs
run: echo "${{needs.bump.outputs.packages}}"

# build:
# needs:
# - bump
# strategy:
# matrix:
# package: ${{ fromJson(needs.bump.outputs.packages) }}
# defaults:
# run:
# working-directory: ${{ matrix.package.name }}

# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4

# - name: Set up Python
# uses: actions/setup-python@v3
# with:
# python-version: "3.x"

# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install build

# - name: Bump version.py
# run: |
# export module=$(sed 's/^.*\///' <<< ${{ matrix.package.name }} | tr '-' '/')
# export version=$(sed 's|-\([0-9]*\)$|\1|' <<< ${{ matrix.package.version }})
# sed -i "s/__version__.*/__version__ = \"$version\"/" $module/version.py

# - name: Build package
# run: python -m build

# - name: Store the distribution packages
# uses: actions/upload-artifact@v3
# with:
# name: python-package-distributions
# path: ${{ matrix.package.name }}/dist/

# publish:
# needs:
# - build

# 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:
# needs:
# - bump
# - publish
# strategy:
# matrix:
# package: ${{ fromJSON(needs.bump.outputs.packages) }}

# runs-on: ubuntu-latest
# env:
# package: $(sed 's/^.*\///' <<< ${{ matrix.package.name }})
# module: $(tr '-' '/' <<< $package)

# steps:
# - uses: actions/checkout@v3

# - 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"
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Bump version.py
run: |
export module=$(${{ matrix.package.name }} | tr '-' '/')
export version=$(sed 's|-\([0-9]*\)$|\1|' <<< ${{ matrix.package.version }})
sed -i "s/__version__.*/__version__ = \"$version\"/" $module/version.py
- name: Build package
run: python -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: ${{ github.workspace }}/dist/

publish:
needs:
- build

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:
needs:
- bump
- publish
strategy:
matrix:
package: ${{ fromJSON(needs.bump.outputs.packages) }}

runs-on: ubuntu-latest
env:
package: $(sed 's/^.*\///' <<< ${{ matrix.package.name }})
module: $(tr '-' '/' <<< $package)

steps:
- uses: actions/checkout@v3

- 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"
7 changes: 5 additions & 2 deletions livekit-plugins/livekit-plugins-minimal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ This is a minimal example of a LiveKit plugin for Agents.

### Developer note

When copying this directory over to create a new `livekit-plugins` package, make sure the `"name"` field in `package.json` follows the proper naming convention for CI:
When copying this directory over to create a new `livekit-plugins` package, make sure it's nested within the `livekit-plugins` folder and that the `"name"` field in `package.json` follows the proper naming convention for CI:

```json
"name": "livekit-plugins/livekit-plugins-<name>"
{
"name": "livekit-plugins-<name>",
"private": true
}
```

0 comments on commit f4afceb

Please sign in to comment.