Skip to content

Commit 1fc7913

Browse files
committed
feat(pypi): add support for v2 branch in release workflow and streamline build/publish process using uv
Signed-off-by: Yurii Serhiichuk <[email protected]>
1 parent 75c0373 commit 1fc7913

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

.github/workflows/pypi-release.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- main
8+
- v2
89
- 'tag/v**'
910

1011
jobs:
@@ -15,17 +16,23 @@ jobs:
1516
- uses: actions/checkout@v5
1617
with:
1718
fetch-depth: 0
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v7
21+
- name: Set up Python
22+
run: uv python install 3.12
23+
- name: Install the project
24+
run: uv sync --all-extras --dev
1825

1926
- name: Build SDist and wheel
20-
run: pipx run build
27+
run: uv run build
2128

2229
- uses: actions/upload-artifact@v5
2330
with:
2431
name: artifact
2532
path: dist/*
2633

2734
- name: Check metadata
28-
run: pipx run twine check dist/*
35+
run: uv run twine check dist/*
2936
publish:
3037
runs-on: ubuntu-24.04
3138
if: github.event_name == 'push'
@@ -34,25 +41,28 @@ jobs:
3441
- uses: actions/checkout@v5
3542
with:
3643
fetch-depth: 0
37-
- name: Set up Python
38-
uses: actions/setup-python@v6
39-
with:
40-
python-version: "3.11"
41-
cache: 'pip'
42-
- name: Install build dependencies
43-
run: pip install -U setuptools wheel build
4444
- uses: actions/download-artifact@v5
4545
with:
46-
# unpacks default artifact into dist/
47-
# if `name: artifact` is omitted, the action will create extra parent dir
4846
name: artifact
4947
path: dist
5048
- name: Publish
5149
uses: pypa/gh-action-pypi-publish@release/v1
5250
with:
5351
user: __token__
5452
password: ${{ secrets.pypi_password }}
55-
- name: Install GitPython and cloudevents for pypi_packaging
56-
run: pip install -U -r requirements/publish.txt
57-
- name: Create Tag
58-
run: python pypi_packaging.py
53+
tag:
54+
runs-on: ubuntu-24.04
55+
needs: [ publish ]
56+
steps:
57+
- uses: actions/checkout@v5
58+
with:
59+
fetch-depth: 0
60+
- name: Extract version
61+
id: version
62+
run: |
63+
echo "version=$(grep -oP '__version__ = \"\K[^\"]+' src/cloudevents/__init__.py)" >> $GITHUB_OUTPUT
64+
- name: Create and push tag
65+
uses: pxpm/[email protected]
66+
with:
67+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
68+
tag: ${{ steps.version.outputs.version }}

0 commit comments

Comments
 (0)