File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish to PyPI
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+ workflow_dispatch :
8+
9+ permissions :
10+ contents : read
11+
12+ jobs :
13+ publish :
14+ name : Build & Publish to PyPI
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - uses : astral-sh/setup-uv@v4
20+ with :
21+ version : " latest"
22+
23+ - name : Build package
24+ run : uv build
25+
26+ - name : Verify package version matches tag
27+ if : startsWith(github.ref, 'refs/tags/v')
28+ run : |
29+ TAG_VERSION="${GITHUB_REF#refs/tags/v}"
30+ PKG_VERSION=$(grep '^version' pyproject.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
31+ if [ "${TAG_VERSION}" != "${PKG_VERSION}" ]; then
32+ echo "::error::Tag version (${TAG_VERSION}) does not match package version (${PKG_VERSION})"
33+ exit 1
34+ fi
35+ echo "Version verified: ${PKG_VERSION}"
36+
37+ - name : Publish to PyPI
38+ run : uv publish dist/*
39+ env :
40+ UV_PUBLISH_TOKEN : ${{ secrets.PYPI_API_TOKEN }}
You can’t perform that action at this time.
0 commit comments