Skip to content

Commit

Permalink
Merge pull request #44 from pipecat-ai/mb/workflow-prod-publish
Browse files Browse the repository at this point in the history
Add a publish workflow for PyPI
  • Loading branch information
markbackman authored Nov 26, 2024
2 parents e21d397 + 633b22a commit ce9ba9d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 8 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish to PyPI

on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish (must match pyproject.toml, e.g. 0.0.4)'
required: true
type: string

jobs:
build-and-publish:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pipecat-ai-flows
permissions:
id-token: write # IMPORTANT: this permission is needed for trusted publishing
contents: write # Needed for tagging

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Verify version matches
run: |
pip install tomli
PROJECT_VERSION=$(python -c "import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['version'])")
if [ "$PROJECT_VERSION" != "${{ github.event.inputs.version }}" ]; then
echo "Error: Input version (${{ github.event.inputs.version }}) does not match pyproject.toml version ($PROJECT_VERSION)"
exit 1
fi
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install build twine
- name: Build package
run: python -m build

- name: Create release tag
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag -a "v${{ github.event.inputs.version }}" -m "Version ${{ github.event.inputs.version }}"
git push origin "v${{ github.event.inputs.version }}"
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true
8 changes: 0 additions & 8 deletions .github/workflows/publish-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
url: https://test.pypi.org/p/pipecat-ai-flows
permissions:
id-token: write # IMPORTANT: this permission is needed for trusted publishing
contents: write # Needed for tagging

steps:
- name: Checkout code
Expand Down Expand Up @@ -45,13 +44,6 @@ jobs:
- name: Build package
run: python -m build

- name: Create Git tag
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag -a "v${{ github.event.inputs.version }}" -m "Version ${{ github.event.inputs.version }}"
git push origin "v${{ github.event.inputs.version }}"
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down

0 comments on commit ce9ba9d

Please sign in to comment.