Skip to content

Commit 5556169

Browse files
authored
Merge pull request #186 from pipecat-ai/mb/more-publish-workflow-fixes
More uv publish workflow fixes
2 parents a01ff4e + 9484852 commit 5556169

2 files changed

Lines changed: 65 additions & 29 deletions

File tree

.github/workflows/publish-pypi.yml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@ on:
99
type: string
1010

1111
jobs:
12-
build-and-publish:
12+
build:
13+
name: 'Build and upload wheels'
1314
runs-on: ubuntu-latest
14-
environment:
15-
name: pypi
16-
url: https://pypi.org/p/pipecat-ai-flows
17-
permissions:
18-
id-token: write # IMPORTANT: this permission is needed for trusted publishing
19-
contents: write # Needed for tagging
20-
2115
steps:
2216
- name: Checkout code
2317
uses: actions/checkout@v4
18+
with:
19+
fetch-tags: true
20+
fetch-depth: 100
2421

2522
- name: Install uv
2623
uses: astral-sh/setup-uv@v3
@@ -32,19 +29,17 @@ jobs:
3229

3330
- name: Verify version matches
3431
run: |
35-
PROJECT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
32+
PROJECT_VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
3633
if [ "$PROJECT_VERSION" != "${{ github.event.inputs.version }}" ]; then
3734
echo "Error: Input version (${{ github.event.inputs.version }}) does not match pyproject.toml version ($PROJECT_VERSION)"
3835
exit 1
3936
fi
4037
41-
- name: Install dependencies
42-
run: |
43-
uv sync
44-
uv pip install build twine
38+
- name: Install development dependencies
39+
run: uv sync --group dev
4540

46-
- name: Build package
47-
run: python -m build
41+
- name: Build project
42+
run: uv build
4843

4944
- name: Create release tag
5045
run: |
@@ -53,6 +48,29 @@ jobs:
5348
git tag -a "v${{ github.event.inputs.version }}" -m "Version ${{ github.event.inputs.version }}"
5449
git push origin "v${{ github.event.inputs.version }}"
5550
51+
- name: Upload wheels
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: wheels
55+
path: ./dist
56+
57+
publish-to-pypi:
58+
name: 'Publish to PyPI'
59+
runs-on: ubuntu-latest
60+
needs: [build]
61+
environment:
62+
name: pypi
63+
url: https://pypi.org/p/pipecat-ai-flows
64+
permissions:
65+
id-token: write
66+
contents: write # Needed for tagging
67+
steps:
68+
- name: Download wheels
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: wheels
72+
path: ./dist
73+
5674
- name: Publish to PyPI
5775
uses: pypa/gh-action-pypi-publish@release/v1
5876
with:

.github/workflows/publish-test.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ on:
99
type: string
1010

1111
jobs:
12-
build-and-publish:
12+
build:
13+
name: 'Build and upload wheels'
1314
runs-on: ubuntu-latest
14-
environment:
15-
name: testpypi
16-
url: https://test.pypi.org/p/pipecat-ai-flows
17-
permissions:
18-
id-token: write # IMPORTANT: this permission is needed for trusted publishing
19-
2015
steps:
2116
- name: Checkout code
2217
uses: actions/checkout@v4
18+
with:
19+
fetch-tags: true
20+
fetch-depth: 100
2321

2422
- name: Install uv
2523
uses: astral-sh/setup-uv@v3
@@ -31,19 +29,39 @@ jobs:
3129

3230
- name: Verify version matches
3331
run: |
34-
PROJECT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
32+
PROJECT_VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
3533
if [ "$PROJECT_VERSION" != "${{ github.event.inputs.version }}" ]; then
3634
echo "Error: Input version (${{ github.event.inputs.version }}) does not match pyproject.toml version ($PROJECT_VERSION)"
3735
exit 1
3836
fi
3937
40-
- name: Install dependencies
41-
run: |
42-
uv sync
43-
uv pip install build twine
38+
- name: Install development dependencies
39+
run: uv sync --group dev
4440

45-
- name: Build package
46-
run: python -m build
41+
- name: Build project
42+
run: uv build
43+
44+
- name: Upload wheels
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: wheels
48+
path: ./dist
49+
50+
publish-to-test-pypi:
51+
name: 'Publish to Test PyPI'
52+
runs-on: ubuntu-latest
53+
needs: [build]
54+
environment:
55+
name: testpypi
56+
url: https://test.pypi.org/p/pipecat-ai-flows
57+
permissions:
58+
id-token: write
59+
steps:
60+
- name: Download wheels
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: wheels
64+
path: ./dist
4765

4866
- name: Publish to TestPyPI
4967
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)