-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from pipecat-ai/mb/publish-workflow
Add github workflow for publishing to TestPyPI
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Publish to TestPyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to publish (must match pyproject.toml)' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
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 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Verify version matches | ||
run: | | ||
PROJECT_VERSION=$(python -c "from configparser import ConfigParser; p = ConfigParser(); p.read('pyproject.toml'); print(eval(p['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 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: | ||
repository-url: https://test.pypi.org/legacy/ | ||
verbose: true | ||
print-hash: true |